Re: Does changing a UNIQUE KEY lock the table?
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.
Subject
Views
Written By
Posted
1567
July 03, 2014 06:46PM
Re: Does changing a UNIQUE KEY lock the table?
753
July 05, 2014 12:25PM
764
July 06, 2014 07:21PM
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.