开发者

SQL Server 2008 uniqueidentifier vs. Binary performance

开发者 https://www.devze.com 2023-04-06 06:48 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消