Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Guid as PK
Message
From
22/03/2010 03:59:49
 
 
General information
Forum:
Microsoft SQL Server
Category:
Database design
Title:
Miscellaneous
Thread ID:
01455992
Message ID:
01456012
Views:
59
Thanks Kevin.


>Hi, Greg,
>
>A few years ago, I worked on a health care application for the CDC - there was a requirement to use GUIDs. At first I thought I'd hate using them, but to be honest, it really wound up being no different, from a development standpoint. (There's an argument to be made that anyone who complains about GUIDs being more difficult than INTs, is probably abusing the concept to begin with).
>
>Obviously, you're talking about four times more storage with a GUID over an INT IDENTITY, and twice as much over a BIGINT.
>
>I'm sure you know this, that you can utilize a BIGINT as an IDENTITY column.
>
>There have been different benchmarks published - along the lines of inserting ten million rows using an IDENTITY column and using a GUID, and JOINs involving both examples. The one thing I recall is that insert performance is quite a bit worse if the GUID is used in a clustered index (over a million iterations of inserts).
>
>My own two cents is while I don't find GUIDs to be any more difficult than using INT identity columns, I also think a compelling case needs to be made for GUIDs, in order to justify using them. An important question to ask is whether EVERY tool you'll use will indeed support GUID data types.
>
>But...I can see some data warehousing scenarios where GUIDs would offer advantages.
>
>Somewhat related topic: I know that Joe Celko is intensely opposed to all identity types. I have never fully agreed with his reasons, but there's one point he makes that I can't argue against. Using an identity as a key, the values will cluster on physical data pages - as a result, if the most recent rows are most likely to be accessed, you'll perhaps have heavy locking contention for those physical data pages. He makes the argument that you want a key that is spread across rows over physical storage to avoid having every user hit the same physical data page at the same time.
>
>p.s. I just did a small test...inserted a bunch of GUIDs and a bunch of BIGINT IDENTITY columns.
>
>it took a little over 13 minutes just to insert 81,000 GUID rows
>It took about 12.5 minutes to insert 81,000 int identity columns.
>
>
>Hope that helps...
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform