Clustered primary key on unique identifier ID column in SQL Server

前端 未结 4 495
栀梦
栀梦 2020-12-06 22:43

If your ID column on a table is a unique identifier (Guid), is there any point creating a clustered primary key on the ID column?

Given that they a

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 23:25

    Putting a clustered index on a guid column is not such a good idea (unless you're making use of sequential guids).

    The clustered index determines the physical order of how the records are stored.
    This means that, if you put a clustered index on a column that does not sequentially grow, SQL Server will have some work making sure that the records are correctly ordered physically when you insert new records.

提交回复
热议问题