Is it wrong to restart MySQL when writing indexes?

I have a file with 40 operators CREATE INDEX. Some time ago I fed this file to my production base and am currently executing commands.

Not so long ago, I accidentally ran a couple of slow queries in my production database, and now, I'm afraid I might have thought about these works. Usually, when I run an unacceptably slow query, I restart MySQL, but I'm not sure I want to do this because I don’t know if it is safe to do this if MySQL follows these instructions CREATE INDEX.

For more context, if I run select * from information_schema.statistics where index_name like 'index_%', I usually see a new index appear every few minutes, but it seems to be stuck on 14 indexes for some time.

Should I restart the server or not?

+3
source share
1 answer

No problems. Use show create table FOOto find out which indexes you are missing and apply. In the end, you can do an optimize table to rebuild all indexes.

Please note that if these 40 create indexstatements are in the same table, you must finally rewrite this (and any other) query into one. Otherwise, you expect 39 times more than you can.

+1
source

Source: https://habr.com/ru/post/1790769/


All Articles