开发者

understanding mysql indexes

开发者 https://www.devze.com 2023-02-28 17:16 出处:网络
I have read a couple of articles but im still having trouble understanding this. I have seen the difference of performance using EXPLAIN. What i dont understand is would i need to do something when th

I have read a couple of articles but im still having trouble understanding this. I have seen the difference of performance using EXPLAIN. What i dont understand is would i need to do something when the tables are beeing altered? Say i开发者_如何学Go delete some rows or add some rows, do i need to create an index for every time or do i need to alter an index or something like that or does mysql fix this itself?

I just did a :

CREATE UNIQUE INDEX rel_index
ON friend_relations (from_id, to_id);

do i need to do some spesific queries when the tables are altered? im coming here becouse i dont really understand how mysql does this.. even if i have checked around.

best of regards, alexander elias nilsen


No, you don't have to adjust the index every time you change the data. When you first create the index, MySQL will populate the index data for pre-existing rows. Then, when you add, remove, or modify rows, MySQL will automatically update the index data.

0

精彩评论

暂无评论...
验证码 换一张
取 消