MySQL indexes - how many are enough?

前端 未结 6 1929
悲&欢浪女
悲&欢浪女 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条回答
  •  旧时难觅i
    2020-12-09 18:36

    An index can speed up a SELECT query, but it will slow down INSERT/UPDATE/DELETE queries because they need to update the index as well, not just the row.

    This is just personal opinion (I've got no facts to back it up), but I think that if there is a query that is taking a long time and an index would speed it up - go for it! "Too many" indexes would be if you added indexes that didn't do any good (e.g. there were no queries it would speed up). For example, a silly thing to do would be to place an index on every column "just because".

提交回复
热议问题