MySQL Forums
Forum List  »  Optimizer & Parser

Re: Automatic creation and inserting to a new table = database or application level?
Posted by: Rick James
Date: September 26, 2008 11:47PM

Yes and no. Look up MERGE or, if you have 5.1, PARTITION.

MERGE table type is a pseudo-table on top of several sub-tables, which is where all the data lives. MERGE lets you, with a small amount of extra code, CREATE a new weekly sub-table and ALTER the definition of the MERGE table. The INSERTing code can be oblivious to this. There is syntax to say that the inserts always go into the 'last' subtable.

PARTITION works similarly [for this situation], but the syntax is quite different.

Note: If you are deleting data that is, say, over a year old, the ALTER, plus a DROP TABLE, can take care of that.

The CREATE/ALTER/DROP is virtually instantaneous.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Automatic creation and inserting to a new table = database or application level?
2236
September 26, 2008 11:47PM


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.