Using more than one index per table is dangerous?

后端 未结 9 1987
春和景丽
春和景丽 2021-02-02 14:25

In a former company I worked at, the rule of thumb was that a table should have no more than one index (allowing the odd exception, and certain parent-tables holding references

9条回答
  •  一整个雨季
    2021-02-02 15:09

    Updating an index is once per insert (per index). Speed gain is for every select. So if you update infrequently and read often, then the extra work may be well worth it.

    If you do different selects (meaning the columns you filter on are different), then maintaining an index for each type of query is very useful. Provided you have a limited set of columns that you query often.

    But the usual advice holds: if you want to know which is fastest: profile!

提交回复
热议问题