Using more than one index per table is dangerous?

后端 未结 9 2018
春和景丽
春和景丽 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:01

    Every table must have a PK, which is indexed of course (generally a clustered one), then every FK should be indexed as well.
    Finally you may want to index fields on which you often sort on, if their data is well differenciated: for a field with only 5 possible values in a table with 1 million records, an index will not be of a great benefit.
    I tend to be minimalistic with indexes, until the db starts beeing well filled, and ...slower. It is easy to identify the bottlenecks and add just the right the indexes at that point.

提交回复
热议问题