Changing newid() to newsequentialid() on an existing table

后端 未结 4 2088
鱼传尺愫
鱼传尺愫 2021-02-04 21:13

At the moment we have a number of tables that are using newid() on the primary key. This is causing large amounts of fragmentation. So I would like to change the column to use n

4条回答
  •  花落未央
    2021-02-04 21:40

    If this is SQL Server, you are generating a Guid by calling newid(). This is not good for primary keys. Use an integer identity column for the primary key, and make your Guid a surrogate key (and a row guid column).

提交回复
热议问题