Once a day I need to update an MySQL table with a new file downloaded from the Net using ftp and then mysqlimport. However, I want my website to keep running smoothly during the mysqlimport operation, which takes quite some time (it’s a big table).
What would be a good way to assure that users do not wait for the import to finish?
I am thinking of importing to a temporary table and then renaming it. Is that a good plan?
Once a day I need to update an MySQL table with a new file
Share
A little known fact is that you can concatenate more than one rename statement in mysql and it will perform all of the name changes atomically.
The rename table will block readers (in fact it will block any resolution of the name) but should be a very fast operation.