MySQL indexes - how many are enough?

前端 未结 6 1934
悲&欢浪女
悲&欢浪女 2020-12-09 17:56

I\'m trying to fine-tune my MySQL server so I check my settings, analyzing slow-query log, and simplify my queries if possible.

Sometimes it is enough if I am indexi

6条回答
  •  孤街浪徒
    2020-12-09 18:38

    There's no magic number for the "best" number of indexes. The basic rule is this: add indexes for queries that are used often and/or need to run quickly.

    Having "too many" indexes shouldn't slow down queries, but it each index added adds a small amount of time to add/update items in the db (since it modifies the indices as well), and a small amount of space. However, if you're just adding indexes as required, this is probably not a big concern.

提交回复
热议问题