Two duplicate indexes with the same columns

前端 未结 2 1506
独厮守ぢ
独厮守ぢ 2021-01-04 03:17

I am looking at a table in our database (I didn\'t make the table), and I see that there are 2 indexes that are exactly the same (I don\'t know why this was done) just named

2条回答
  •  感动是毒
    2021-01-04 04:00

    Yes, it will impact performance. Every time you write a new row or change the user_id, MySQL has to write three times: once to the table, once to the user_id_idx index, and once to the user_id_2 index. I'd get rid of one of them.

    Before dropping the extra index, make sure it's not referenced anywhere. For the most part indexes aren't mentioned by name, but there are exceptions such as index hints.

提交回复
热议问题