On Wed, Dec 16, 2009 at 11:07:52AM +0100, Paul McCullagh wrote:
> >I see it working as a 2 step process.
> >
> >step 1 is pass a list of changes to the engine and it returns a list
> >of what it can't do. (this could then be used for EXPLAIN ALTER
> >TABLE).
> >
> >If the list of what it can't do is not empty, we do a copying alter
> >table.
> 
> Yup, but actually I see only 2 possibilities here:
> 
> 1. The engine can handle ALL actions internally.
> 2. We use the (default) copy alter table method.
> 
> I don't see why we would need a combination of 1 and 2.

Probably wouldn't... although I guess in some situations it *could* be
faster... maybe... but i'm pretty sure we don't need to worry about it
yet :)

EXPLAIN ALTER TABLE is more of a tool for working out what can (and
cannot) be done online.

> For example if an ALTER TABLE calls for 2 actions: ADD COLUMN and
> ADD INDEX, and the engine can only do ADD INDEX internally, then it
> would make no sense to use method 1 for ADD INDEX and method 2 for
> ADD COLUMN.
> 
> In fact, if an ALTER TABLE adds 2 indexes it may be better to for
> the engine to pick method 2 (which does all changes at once), if its
> implementation of ADD INDEX can only add one index at a time.

of course, it can depend on if you want a lock to be held or not.
Sometimes you won't care if it takes 10 times as long, as long as
you're not blocking users during it.

Other situations may call for "just get it done quickly".

Which is why we have ALTER TABLE, ALTER TABLE ONLINE and ALTER TABLE
OFFLINE to do "best effort", "fail if cannot be done online" and
"force an offline copying alter table" (all introduced for NDB).

-- 
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

Reply via email to