vrypan — panayotis vryonis
My blog is a digital scrapbook of ideas, thoughts and personal events. My home is vrypan.net.
Home — Archive: All · English · Greek — RSS Feeds: full feed · other options
#misc #misc #en

Exporting a HUGE MySQL table on a slow server.

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.

Share this post:
The Letter is a newsletter I send out whenever I have something to say or share. It may take a few days, weeks or months for the next one.
Privacy: I hate spam as much as you do, maybe more. I will not share your email with advertisers, etc.