11

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)?

0

1 Answer 1

14

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?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.