Can I create index on a table in a MySQL database while in use
-
16-10-2019 - |
Question
And if I can, any reason (performance/stability) why I shouldn't?
Solution
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).
OTHER TIPS
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange