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.

1 Answer 1


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.

  • 1
    Just making sure.
    – Tim Meers
    Feb 29, 2012 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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