archive about

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.