Is a Primary Key necessary in SQL Server?

前端 未结 10 1169
旧时难觅i
旧时难觅i 2020-12-05 03:58

This may be a pretty naive and stupid question, but I\'m going to ask it anyway

I have a table with several fields, none of which are unique, and a primary key, whic

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 04:37

    The primary key is behind the scenes a clustered index (by default unless generated as a non clustered index) and holds all the data for the table. If the PK is an identity column the inserts will happen sequentially and no page splits will occur.

    But if you don't access the id column at all then you probably want to add some indexes on the other columns. Also when you have a PK you can setup FK relationships

提交回复
热议问题