Exporting a HUGE MySQL table on a slow server.

misc — Panayotis @ 07:10

So, we had to export this MySQL table, nearly 1,000,000 rows. 1m rows is not much, I know, but the machine is a PII with 512MB RAM.

mysqldump --opt dbname mytable >exportfile

took for ever, and I think the machine would crash in the end, anyway…

The solution? Incremental mysqldump:
last=0 ; for i in `seq 1000 1000 999000` ; do mysqldump -c -t -w "id< $i and id>$last" dbname mytable >>exportfile.sql ; last=$i ; done
</>

DONE.

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2009 vrypan|net|log | powered by WordPress with Barecity