-
-
Save sumanthkumarc/a5e3c8d84e742db9969e35dd25a459f1 to your computer and use it in GitHub Desktop.
Naive parallel import of Compressed MYSQL dump file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Split MYSQL dump file | |
zcat dump.sql.gz | awk '/DROP TABLE IF EXISTS/{n++}{print >"out" n ".sql" }' | |
# Parallel import using GNU Parallel http://www.gnu.org/software/parallel/ | |
ls -rS *.sql | parallel --joblog joblog.txt mysql -uXXX -pYYY db_name "<" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
easy to do instructions:
#zcat dump.sql.gz | awk '/DROP TABLE IF EXISTS/{n++}{print >"out" n ".sql" }'
#command above splits your db into multiple files, so better create a folder , put your dump.sql.gz file(ie., rename to dump.sql and then compress to gz format, if you don't want/know editing above command!!!)
#ls -rS *.sql | parallel --joblog joblog.txt mysql -uXXX -pYYY db_name "<"
Running this command , imports all you tables using parallel. Create an empty database and Put database username and password and database name you just created in above command.