In SQL Server, should I create an index for an identity column, or is it created automatically?

后端 未结 3 872
Happy的楠姐
Happy的楠姐 2020-12-10 11:03

I believe when I create an identity column it gets indexed automatically, but I\'m not 100% sure.

Should I create an index for an identity

3条回答
  •  粉色の甜心
    2020-12-10 12:04

    By default, your primary key column(s) will be made into a clustered index; this is a special index that is not separate from the data - but instead, the data is ordered in the table by that indexes values.

    I say 'by default', because you can change the clustered index to another field if you wanted. If you've chosen a good identity value for your primary key, you will almost never want to change this, though.

提交回复
热议问题