Is it a bad idea to use GUIDs as primary keys in MS SQL?

前端 未结 7 1515
时光说笑
时光说笑 2020-12-23 08:10

We have a system that uses UniqueIdentifier as the primary key of each of the tables. It has been brought to our attention that this is a bad idea. I have seen similar post

7条回答
  •  清歌不尽
    2020-12-23 08:41

    I wrote a post about this last week with some code to show you what happens: Some Simple Code To Show The Difference Between Newid And Newsequentialid

    Basically if you use newid() instead of Newsequentialid() you get horrible page splits if your PK is a clustered index (which it will be by default)

提交回复
热议问题