Clustered primary key on unique identifier ID column in SQL Server

前端 未结 4 470
栀梦
栀梦 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条回答
  •  既然无缘
    2020-12-06 23:25

    The idea of having a sorted index is very good in itself as searching then becomes very efficient.

    The problem however is that in case of a GUID one never searches with "WHERE GUID = xyz". So the whole concept is wasted. So I would suggest to rather have a clustered index on a column which is used most often as a SARG to increase the query efficiency.

提交回复
热议问题