I have an InnoDB table on MySQL 5.6, and I'd like to add a unique constraint to a VARCHAR column (let's call it column x). Pretty simple, except that I have over 5 million rows, so I want to anticipate any problems before I start.
Specific questions:
- Ballpark estimate for how long this will take?
- I plan to remove duplicate values for
xbefore I start. But if someone tries to insert a non-unique value forxwhile the ALTER operation to add the constraint is in progress, what will happen? - Is there any difference between
ADD UNIQUE,ADD CONSTRAINT UNIQUE,ADD UNIQUE INDEX?
Thanks in advance.