MySQL Forums
Forum List  »  General

Re: Is there a known pattern for creating caches of data?
Posted by: Rick James
Date: June 02, 2013 08:36PM

CREATE TABLE new LIKE cache;
Populate new. (Note: the LIKE will already have the indexes.)
RENAME TABLE cache TO old, new TO cache;
DROP TABLE old;

Since the RENAME is atomic, you will never see "no such table".

Options: ReplyQuote


Subject
Written By
Posted
Re: Is there a known pattern for creating caches of data?
June 02, 2013 08:36PM


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.