5

I have a few MySQL tables and I want to change the data type of some of the existing fields. The fields already have some single and multi-column indexes on them (all of which are type = "Normal").

I would like to know if changing the data types of any fields included in the existing indexes will have any effect on those indexes? Do I need to remove and re-create them for example or does MySQL handle that automatically?

0

1 Answer 1

7

Changing the data type of a column causes a table restructure, which will have the side-effect of rebuilding all indexes for the table (not only those referencing the column you altered, but all indexes in that table).

You don't need to drop or recreate the indexes yourself; it's already done by the time the ALTER TABLE finishes.

Your Answer

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

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