MySQL Forums
Forum List  »  InnoDB

Re: Does changing a UNIQUE KEY lock the table?
Posted by: Rick James
Date: July 05, 2014 12:25PM

Two questions before answering your question:
* MyISAM or InnoDB?
* What version of MySQL? (Newer versions have improved ALTER.)

Some partial answers:
* DROPping a key (other than PRIMARY KEY) used to require copying the table over.
* ADDing a UNIQUE key probably requires copying the table over and does require checking for UNIQUEness.
* When the table must be copied, it is more efficient to do all ALTERs in a single ALTER statement.
* Writes are not allowed to the table during the ALTER. This may be what you are calling "lock the table".

Would you care to show us the SHOW CREATE TABLE.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Does changing a UNIQUE KEY lock the table?
753
July 05, 2014 12:25PM


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.