mysql index adding
We have 50 tables in o开发者_运维技巧ur mysql database. Queries are taking time as many of the tables have more than 15K records.
I know adding indexes increases the query performance, my query is, on adding indexes on existing tables will have any harm to existing users?
Please share your thoughts.
Thanks.
It won't do any harm to existing users. Although, like sAc said, updating (as well as adding and deleting) will be slower as the index has to be updated when you perform these operations. beware: adding an index to a huge table can render it un-usable during the time it takes, so if your website (or app) is dependant on the DB, it will be un-usable during the updating. you can prevent the blockage with something like this (pseudo-code):
create table temp like my_table;
update logger to log in temp;
alter table my_table add index new_index;
insert into my_table select * from temp;
update logger to log in my_table;
drop table temp
精彩评论