What's the best practice for primary keys in tables?

前端 未结 21 2481
别那么骄傲
别那么骄傲 2020-11-22 14:02

When designing tables, I\'ve developed a habit of having one column that is unique and that I make the primary key. This is achieved in three ways depending on requirements

21条回答
  •  礼貌的吻别
    2020-11-22 14:30

    GUIDs can be used as a primary key, but you need to create the right type of GUID so that it performs well.

    You need to generate COMB GUIDs. A good article about it and performance statistics is The Cost of GUIDs as Primary Keys.

    Also some code on building COMB GUIDs in SQL is in Uniqueidentifier vs identity(archive).

提交回复
热议问题