What are the differences between a clustered and a non-clustered index?

后端 未结 12 1378
攒了一身酷
攒了一身酷 2020-11-29 14:24

What are the differences between a clustered and a non-clustered index?

12条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 15:04

    Clustered indexes are stored physically on the table. This means they are the fastest and you can only have one clustered index per table.

    Non-clustered indexes are stored separately, and you can have as many as you want.

    The best option is to set your clustered index on the most used unique column, usually the PK. You should always have a well selected clustered index in your tables, unless a very compelling reason--can't think of a single one, but hey, it may be out there--for not doing so comes up.

提交回复
热议问题