MySQL Forums
Forum List  »  Performance

Re: insert or load ? best practices and performance
Posted by: Rick James
Date: September 17, 2010 06:37PM

If practical, do this:
DROP TABLE IF EXISTS old; -- comes into effect after first day
CREATE TABLE new LIKE real; -- easy to create identical schema
LOAD DATA INFILE ... INTO new; -- very fast
RENAME TABLE real TO old, new TO real; -- zero downtime

Caveat: If you have FOREIGN KEYS, there may be issues.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.