Created
August 3, 2011 19:17
-
-
Save alkema/1123536 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE for_ddl LIKE foo; | |
insert into for_ddl select * from foo WHERE ...; | |
ALTER TABLE for_ddl DROP INDEX bar; | |
more ddl... | |
RENAME TABLE foo TO old_foo; | |
RENAME TABLE for_ddl TO foo; | |
DROP TABLE old_foo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RENAME TABLE foo TO foo_old, foo_new TO foo;
is atomic & transactional, no need to lock
but this is missing the "copy the data part", which is the real problem, no? :)