SQL Server 2008 uniqueidentifier vs. Binary performance
In a logging perspective with millions of rows. What is the preferred way?
Do you store the Guid as a UniqueIdentifier
or in Binary
? Which is faster for searching?
The C# part of generating the values is no开发者_如何学Pythont an issue here.
A GUID is stored as binary but there are rules attached when comparing and sorting that are different to straight binary. See How is a guid actually stored and sorted/compared in SQL Server? for more
Whatever you choose, don't use a GUID a a clustered index. For why, see What are the reasons *not* to use a GUID for a primary key? as one example.
精彩评论