Is a Primary Key necessary in SQL Server?

前端 未结 10 1171
旧时难觅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

    A primary key is really a property of your domain model, and it uniquely identifies an instance of a domain object.

    Having a clustered index on a montonically increasing column (such as an identity column) will mean page splits will not occur, BUT insertions will unbalance the index over time and therefore rebuilding indexes needs to be done regulary (or when fragmentation reaches a certain threshold).

    I have to have a very good reason to create a table without a primary key.

提交回复
热议问题