Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 6 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

 
discard

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.