Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If you alter a table to add an index, what could happen if that thread was killed during processing?

Accroding to MySQL:

During ALTER TABLE, the kill flag is checked before each block of rows are read from the original table. If the kill flag was set, the statement is aborted and the temporary table is deleted.

Edit: Just making sure that it's not going to cause any additional issues.

share|improve this question
up vote 7 down vote accepted

What is unclear about that?

MySQL creates a temporay table with the new data structure, copies the data from the original table and when everything is finished, use the temp table as primary one.

If this fails at any step (possibly due to the abortion of the ALTER TABLE statement), the temporary table gets deleted and nothing happens.

share|improve this answer
Just making sure. – Tim Meers Feb 29 '12 at 19:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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