MySQL dumps_MySQL
As part of theHTTP Archiveproject, I create MySQL dumps for each crawl (on the 1st and 15th of each month). You can access the list of dumps from thedownloads page. Several people use these dumps, most notablyIlya Grigorik who imports the data into Google BigQuery.
For the last year I’ve hesitated on many feature requests because they require schema changes. I wasn’t sure how changing the schema would affect the use of the dump files that preceded the change. This blog post summarizes my findings.
Format
When I started the HTTP Archive all the dumps were exported in MySQL format using a command like the following:
mysqldump --opt --skip-add-drop-table -u USERNAME -p -h SERVER DBNAME TABLENAME | gzip > TABLENAME.gz
These MySQL formatted dump files are imported like this:
gunzip -c TABLENAME.gz | mysql -u USERNAME -p -h SERVER DBNAME
People using databases other than MySQL requested that I also export in CSV format. The output of this export command is two files: TABLENAME.txt and TABLENAME.sql. The .txt file is CSV formatted and can be gzipped with a separate command.
mysqldump --opt --complete-insert --skip-add-drop-table -u USERNAME -p -h SERVER -T DIR DBNAME TABLENAMEgzip -c DIR/TABLENAME.txt > DIR/TABLENAME.csv.gz
This CSV dump is imported like this:
gunzip DIR/TABLENAME.csv.gzmysqlimport --local --fields-optionally-enclosed-by="/"" --fields-terminated-by=, --user=USERNAME -p DBNAME DIR/TABLENAME.csv
The largest HTTP Archive dump file is ~25G unzipped and ~3G gzipped. This highlights a disadvantage of using CSV formatted dumps: there’s no way to gzip and ungzip in memory. This is because themysqlimport command uses the filename to determine which table to use – if you piped in the rows then it wouldn’t know the table name. Unzipping a 25G file can be a challenge if disk space is limited.
On the other hand, the CSV import is ~30% faster than using the MySQL format file. This can save over an hour when importing 30 million rows. The HTTP Archive currently provides dumps in both MySQL and CVS format so people can choose between less disk space or faster imports.
Forward Compatibility
My primary concern is with the flexibility of previously-generated dump files in light of later schema changes – namely adding and dropping columns.
Dump files in MySQL format work fine with added columns. The INSERT commands in the dump are tied to specific column names, so the new columns are simply ignored. CSV formatted dumps are less flexible. The values in a row are stuffed into the table’s columns in order. If a new column is added at the end, everything works fine. But if a column is added in the middle of the existing columns, the row values will all shift one column to the left.
Neither format works well with dropped columns. MySQL formatted files will fail with an “unknown column” error. CSV formatted files will work but all the columns will be shifted, this time to the right.
Takeaways
I now feel comfortable making schema changes without invalidating the existing dump files provided I follow these guidelines:
- don’t drop columns– If a column is no longer needed, I’ll leave it in place and modify the column definition to be a small size.
- add columns at the end– I prefer to organize my columns semantically, but all new columns from this point forward will be added at the end.
I’ll continue to create dumps in MySQL and CSV format. These guidelines ensure that all past and future dump files will work against the latest schema.

Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

AI Hentai Generator
Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

Heiße Werkzeuge

Notepad++7.3.1
Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version
Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6
Visuelle Webentwicklungstools

SublimeText3 Mac-Version
Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Heiße Themen

In diesem Artikel wird die Optimierung von MySQL -Speicherverbrauch in Docker untersucht. Es werden Überwachungstechniken (Docker -Statistiken, Leistungsschema, externe Tools) und Konfigurationsstrategien erörtert. Dazu gehören Docker -Speichergrenzen, Tausch und CGroups neben

Dieser Artikel befasst sich mit MySQLs Fehler "Die freigegebene Bibliotheksfehler". Das Problem ergibt sich aus der Unfähigkeit von MySQL, die erforderlichen gemeinsam genutzten Bibliotheken (.SO/.dll -Dateien) zu finden. Lösungen beinhalten die Überprüfung der Bibliotheksinstallation über das Paket des Systems m

In dem Artikel werden mithilfe der Änderungstabelle von MySQL Tabellen, einschließlich Hinzufügen/Löschen von Spalten, Umbenennung von Tabellen/Spalten und Ändern der Spaltendatentypen, erläutert.

Dieser Artikel vergleicht die Installation von MySQL unter Linux direkt mit Podman -Containern mit/ohne phpmyadmin. Es beschreibt Installationsschritte für jede Methode und betont die Vorteile von Podman in Isolation, Portabilität und Reproduzierbarkeit, aber auch

Dieser Artikel bietet einen umfassenden Überblick über SQLite, eine in sich geschlossene, serverlose relationale Datenbank. Es beschreibt die Vorteile von SQLite (Einfachheit, Portabilität, Benutzerfreundlichkeit) und Nachteile (Parallelitätsbeschränkungen, Skalierbarkeitsprobleme). C

In diesem Handbuch wird die Installation und Verwaltung mehrerer MySQL -Versionen auf macOS mithilfe von Homebrew nachgewiesen. Es betont die Verwendung von Homebrew, um Installationen zu isolieren und Konflikte zu vermeiden. Der Artikel Details Installation, Starten/Stoppen von Diensten und Best PRA

In Artikel werden die Konfiguration der SSL/TLS -Verschlüsselung für MySQL, einschließlich der Erzeugung und Überprüfung von Zertifikaten, erläutert. Das Hauptproblem ist die Verwendung der Sicherheitsauswirkungen von selbstsignierten Zertifikaten. [Charakterzahl: 159]

In Artikel werden beliebte MySQL -GUI -Tools wie MySQL Workbench und PhpMyAdmin beschrieben, die ihre Funktionen und ihre Eignung für Anfänger und fortgeschrittene Benutzer vergleichen. [159 Charaktere]
