Good morning/afternoon/night.
I attempted to add a column to a table with a good few million rows. Here is the full query:
alter table date_tasks_mark add column noDuplicate int unsigned not null default 0
However it seems to be stuck.
| 28893 | root | localhost | database_name | Query | 10668 | Waiting for table metadata lock | alter table date_tasks_marks add column noDuplicate int unsigned not null default 0
Is it safe for me to kill the query or will it corrupt my table (it has been in this state for about a half hour)?
Best Answer
Yes, it's safe. Your
alter table
query hasn't even started.However, the
waiting for table metadata lock
means, that there's another transaction operating on that table for a long time and you should rather kill that one to solve the problem. (read more about it here: 8.11.4 Metadata Locking)To find this transaction, this thread is probably helpful: How do I find which transaction is causing a “Waiting for table metadata lock” state?