I have approx 10M rows of data across 20 tables, which I process once a month.
I do this by copying those tables into a new schema (database) then making the changes, so the updates are not running against tables that are being queried.
To make the new data live, I have tried:
- changing the database name that's coded into the application to point to the new data
- running a big RENAME TABLE statement that adds a prefix e.g. OLD to the live tables and moves the new tables into the live database
With both methods the server load goes from approx 0.1 to over 50, before gradually returning to normal. I would like to avoid this spike if possible.
The query cache is switched off, I've tried FLUSH TABLES and restarting MySQL immediately after the change.
The data is only read (not updated) from my site, so I guess it may be Linux (we use RHEL5.3) buffering the 5GB of data, and having to rebuffer the new data.
Has anyone got any suggestions on how to avoid the increased load?