Quantcast
Viewing all articles
Browse latest Browse all 1957

Index re-creation after composite primary key change (2 replies)

I need to extend a column in a quite big table (~90M rows). (MySQL 5.1.35, InnoDB)

It's a varchar(15) column that needs to be extended to varchar(20). This column is a part of the primary key.

I did some reading in the mysql documents and it looks like a temporary table will be created for that process and at the end a swap will be done. So it won't lock the table and things like that...

But how will be the index re-creation process behave, I assume that the initial index will be dropped and a new one has to be created?

Will it be re-created while the temporary table is populated so without impact on the performance?

I did some reading and I found an indirect proof for my theory(that everything should be ok).
On this page: http://dev.mysql.com/doc/innodb-plugin/1.0/en/innodb-create-index-overview.html

"The CREATE INDEX and DROP INDEX commands work by creating a new, empty table defined with the requested set of indexes. It then copies the existing rows to the new table one-by-one, updating the indexes as it goes."

If somebody could backup my theory...


Cheers!

Viewing all articles
Browse latest Browse all 1957

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>