snippetsqlCritical
How can I monitor the progress of an import of a large .sql file?
Viewed 0 times
canthefilehowsqlprogresslargemonitorimport
Problem
I am importing a 7 GB
How can I monitor its progress?
foobar.sql to restore a table in a local database. $ mysql -h localhost -u root 'my_data' < foobar.sql
$ mysql --version
/usr/local/mysql/bin/mysql Ver 14.12 Distrib 5.0.96, for apple-darwin9.8.0 (i386) using readline 5.1How can I monitor its progress?
Solution
If you're just importing from a dump file from the CLI on *nix, e.g.
then first install pipe viewer on your OS then try something like this:
which will show a progress bar as the program runs.
It's very useful and you can also use it to get an estimate for mysqldump progress.
pv dumps the
mysql -uxxx -pxxx dbname < /sqlfile.sqlthen first install pipe viewer on your OS then try something like this:
pv sqlfile.sql | mysql -uxxx -pxxxx dbnamewhich will show a progress bar as the program runs.
It's very useful and you can also use it to get an estimate for mysqldump progress.
pv dumps the
sqlfile.sql and passes them to mysql (because of the pipe operator). While it is dumping, it shows the progress. The cool thing is that mysql takes the data only as fast as it can progress it, so pv can show the progress of the import. I do not have any proof. But it seems so. I guess there is some buffer used, but at some point I think mysql does not read any more data when it is still busy processing.Code Snippets
mysql -uxxx -pxxx dbname < /sqlfile.sqlpv sqlfile.sql | mysql -uxxx -pxxxx dbnameContext
StackExchange Database Administrators Q#17367, answer score: 397
Revisions (0)
No revisions yet.