Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

And if I can, any reason (performance/stability) why I shouldn't?

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted

Note that if your table is using the InnoDB Plugin storage engine (which I highly recommend), if it's a secondary index (almost surely the case), you can still read from the table (i.e. it's non-blocking to SELECT statements).

share|improve this answer
    
MySQL 5.6 update (feb 2013): you can now read and write to the table with online DDL - dev.mysql.com/doc/refman/5.6/en/… –  Morgan Tocker Dec 18 '13 at 4:55
add comment

Yes you can. It will lock the table you're adding an index to while it's being created. If the table is large, it may take awhile as it has to read each row while building the index.

share|improve this answer
    
Facebook has a solution for doing this online. Haven't tried it out myself: facebook.com/notes/mysql-at-facebook/… –  esilver Oct 13 '11 at 22:34
add comment

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.