Once a week I need to run a giant database update into my local development environment like so:
$ gunzip < /path/to/database1.sql.gz | mysql -uUSER -p database1 &
$ gunzip < /path/to/database2.sql.gz | mysql -uUSER -p database2 &
$ gunzip < /path/to/database3.sql.gz | mysql -uUSER -p database3 &
I try to run these overnight since it can take several hours to complete.
Can you help me come up with a way to show progress on these tasks?
Here are some guesses:
- Get the uncompressed filesize of the db and compare with my local db size
- Run
show processlist
in mysql to see what table it's currently inserting (my current method, but some tables are huge, and at least one db of mine only has one giant table so the bulk of the process is stuck in this table, leaving this option less than helpful)
All of the db.sql.gz files are standard gzipped mysqldumps, so I don't think I can build anything into the dumps to give me an update. (But I'm open to that if I'm missing something)
Bounty Rules
Answers must:
- Provide useful and reasonably accurate progress (either visual like
scp
(preferred!) or through a simple progress database table that could be accessed easily). - Not break regular
mysqldump
export or regulargunzip ... | mysql
import (for other engineers who may not use whatever you come up with) - Not give my DBA a heart attack — so stay easy on special
mysqldump
or alternative mysql branch requests.