On Thu, Jan 08, 2009 at 10:39:08PM -0500, Sheeri K. Cabral wrote: > Alterations that modify only table metadata and not table data can be > made immediately by altering the table's .frm file and not touching table > contents. The following changes are fast alterations that can be made this > way:
This stuff scares me... and probably has 15 oddities and bugs with various engines. > It also lists renaming as a fast operation. What we really need is EXPLAIN ALTER TABLE alongside the ALTER TABLE ONLINE and OFFLINE keywords. i.e. if ALTER TABLE ONLINE is specified and it can't be done without a lock/copy, statement fails. OFFLINE forces offline (i.e. copy) and neither try to do it online if possible. EXPLAIN could be used to find out what may happen :) Not sure how much of this has made it into the source tree that is now Drizzle... but in modern NDB trees, only missing explain. > During a recent MySQL User Group meeting where we were discussing the online > ALTER TABLE options (new in 5.1), the following question came up: > > Why isn't dropping an index/primary key/unique key/foreign key an online > operation? Or rather, why is it slow? It should be easy to drop an index, > there's no updating needed other than "don't use the index object any more". Needs engine support.... to tell it to stop updating the index. DROP COLUMN is "trivial" to do though - you don't have to even tell the engine (doesn't save much storage space that way though... at least for some engines). The code in 5.1 for the online alter is much different than what we've ended up with now though. what we have now is a lot more flexible - and more online operations should come out of the woodwork as engine authors realise that it's a really good idea to be really online*. [*] NDB already gets this... and is getting there.... -- Stewart Smith _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

