Atomic RENAME Table Reload
suggest changeRENAME TABLE t TO t_old, t_copy TO t;
No other sessions can access the tables involved while RENAME TABLE executes, so the rename operation is not subject to concurrency problems.
Atomic rename is especially useful for completely reloading a table without waiting for DELETE and the load to finish:
CREATE TABLE new LIKE real;
-- Load `new` by whatever means: LOAD DATA, INSERT, and so on.
RENAME TABLE real TO old, new TO real;
DROP TABLE old;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents