SQL Server database with clustered GUIDs - switch clustered index or switch to sequential (comb) GUIDs?

We have a database in which all PCs are GUIDs, and most PKs are also a clustered index for the table. We know this is bad (due to the random nature of the GUID). Thus, it seems that there are basically two options here (without highlighting the GUID as a PC at all, which we cannot do (at least not at this time)).

  • We could change the GUID generation algorithm, for example, the one that NHibernate uses as described in this post , or
  • we could, for the tables under the greatest use, switch to another clustered index, for example. IDENTITY column and save the "random" GUID as a PC.

Can any general recommendations be given in such a scenario?

In this application, there are more than 500 tables, the largest of which is about 1.5 million rows, several tables are about 500,000 rows, and the rest are much lower (most of them are much lower than 10K).

In addition, the application has already been installed on several customer sites, so we must take into account any possible negative consequences for an existing client.

Thank!

+5
source share
2 answers

, , , . guid , . , , , , , .

Identity , guid, guid. , , .

, , , , , .

+3

: INT IDENTITY . , , , , :

  • ( )
  • -

GUID , GUID, INT (16 4 ), , , - . , 16 4 . SQL Server , , / SQL Server.

GUID , , INT INT INT . , - 99 , .

Kimberly Tripp , GUID SQL Server :

+7

All Articles