<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Designing primary keys</title>
	<atom:link href="http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Tue, 18 Jun 2013 19:00:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: john</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-576</link>
		<dc:creator>john</dc:creator>
		<pubDate>Fri, 09 Jan 2009 21:21:44 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-576</guid>
		<description>has anyone ran tests with using the newsequentialid().  Does it give any of the performance benefits that the comb GUID this article talks about.</description>
		<content:encoded><![CDATA[<p>has anyone ran tests with using the newsequentialid().  Does it give any of the performance benefits that the comb GUID this article talks about.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Bogard</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-575</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Sat, 14 Jun 2008 21:09:12 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-575</guid>
		<description>@Aaron

Just curious, were these GUIDs in this table combed GUIDs?  Also, it sounds like since this was a log table, and not one for entities (that need to be UPDATEd as much as INSERTed), that also has to be a consideration.

When we used combed GUIDs on a particularly large Oracle installtation (~1TB, most in one table), we didn&#039;t run into any problems.   Then again, it&#039;s Oracle.</description>
		<content:encoded><![CDATA[<p>@Aaron</p>
<p>Just curious, were these GUIDs in this table combed GUIDs?  Also, it sounds like since this was a log table, and not one for entities (that need to be UPDATEd as much as INSERTed), that also has to be a consideration.</p>
<p>When we used combed GUIDs on a particularly large Oracle installtation (~1TB, most in one table), we didn&#8217;t run into any problems.   Then again, it&#8217;s Oracle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Murray</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-574</link>
		<dc:creator>Aaron Murray</dc:creator>
		<pubDate>Thu, 12 Jun 2008 14:15:03 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-574</guid>
		<description>As some others have stated, and I want to reiterate, please do not use db guids as the primary key *unless you must* 

Just last week I had to deal with a table that used guids for the PK, and the table was so burdened that it finally became unresponsive during inserts. The table had approx 120 million records in it (giant log table), but each insert was causing hundreds of disk hits because the clustered index was gigantic. We recreated the table with a new indentity column (int) and left the guid column on there without constraints. The table started behaving correctly again.

</description>
		<content:encoded><![CDATA[<p>As some others have stated, and I want to reiterate, please do not use db guids as the primary key *unless you must* </p>
<p>Just last week I had to deal with a table that used guids for the PK, and the table was so burdened that it finally became unresponsive during inserts. The table had approx 120 million records in it (giant log table), but each insert was causing hundreds of disk hits because the clustered index was gigantic. We recreated the table with a new indentity column (int) and left the guid column on there without constraints. The table started behaving correctly again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-573</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Mon, 09 Jun 2008 12:21:27 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-573</guid>
		<description>Wow.  Apparently no DBAs read this blog (which isn&#039;t necessarily a bad thing!).  

Relevant links:
Celko on PKs
http://www.intelligententerprise.com/channels/business_intelligence/showArticle.jhtml?articleID=201806814
Atwood on Celko on PKs
http://www.codinghorror.com/blog/archives/000817.html

The last time I created a database I mixed guids with natural keys.  The guids have not caused me any problems.  The natural keys have been a headache, as I didn&#039;t plan them correctly (is that EVER possible?).  

I think unless I have strict requirements for speed and size I&#039;m going to be sticking with guids from now on.</description>
		<content:encoded><![CDATA[<p>Wow.  Apparently no DBAs read this blog (which isn&#8217;t necessarily a bad thing!).  </p>
<p>Relevant links:<br />
Celko on PKs<br />
<a href="http://www.intelligententerprise.com/channels/business_intelligence/showArticle.jhtml?articleID=201806814" rel="nofollow">http://www.intelligententerprise.com/channels/business_intelligence/showArticle.jhtml?articleID=201806814</a><br />
Atwood on Celko on PKs<br />
<a href="http://www.codinghorror.com/blog/archives/000817.html" rel="nofollow">http://www.codinghorror.com/blog/archives/000817.html</a></p>
<p>The last time I created a database I mixed guids with natural keys.  The guids have not caused me any problems.  The natural keys have been a headache, as I didn&#8217;t plan them correctly (is that EVER possible?).  </p>
<p>I think unless I have strict requirements for speed and size I&#8217;m going to be sticking with guids from now on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Saggett</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-572</link>
		<dc:creator>Bob Saggett</dc:creator>
		<pubDate>Sun, 08 Jun 2008 08:17:04 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-572</guid>
		<description>@bogardj

You are absolutely correct  Identities in a multi-server environment or a synchronised off-line environment where users can write to the database off-line are unusable.  The possibility of synchronsation and replication should be consdered carefully before thinking about using identities.</description>
		<content:encoded><![CDATA[<p>@bogardj</p>
<p>You are absolutely correct  Identities in a multi-server environment or a synchronised off-line environment where users can write to the database off-line are unusable.  The possibility of synchronsation and replication should be consdered carefully before thinking about using identities.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Bogard</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-571</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Sat, 07 Jun 2008 18:52:54 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-571</guid>
		<description>@Benny

Good - I&#039;m not a DBA either!  :)

There&#039;s another reason why I don&#039;t like the identity column also.  It&#039;s too easy to put a number in and just get something back.  When integrating with other systems that use INT identifiers, I always wind up having to do an extra verification, just to make sure I got back what I meant to ask for.</description>
		<content:encoded><![CDATA[<p>@Benny</p>
<p>Good &#8211; I&#8217;m not a DBA either!  <img src='http://lostechies.com/jimmybogard/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>There&#8217;s another reason why I don&#8217;t like the identity column also.  It&#8217;s too easy to put a number in and just get something back.  When integrating with other systems that use INT identifiers, I always wind up having to do an extra verification, just to make sure I got back what I meant to ask for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Bogard</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-570</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Sat, 07 Jun 2008 18:49:04 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-570</guid>
		<description>@Bob

Yes, there&#039;s definitely a greater chance of collision.  It&#039;s a risk.  But when using identity columns with increasing numbers, collision is guaranteed (in replication scenarios).

If all of the GUIDs are comb&#039;ed, then the chance of a collision is the chance that two GUIDs are created with the same value _in the same time window_.  I&#039;d have to remember back to my stats class to figure out the probability...</description>
		<content:encoded><![CDATA[<p>@Bob</p>
<p>Yes, there&#8217;s definitely a greater chance of collision.  It&#8217;s a risk.  But when using identity columns with increasing numbers, collision is guaranteed (in replication scenarios).</p>
<p>If all of the GUIDs are comb&#8217;ed, then the chance of a collision is the chance that two GUIDs are created with the same value _in the same time window_.  I&#8217;d have to remember back to my stats class to figure out the probability&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jimmy Bogard</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-569</link>
		<dc:creator>Jimmy Bogard</dc:creator>
		<pubDate>Sat, 07 Jun 2008 18:42:16 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-569</guid>
		<description>@Lars

That&#039;s why we use the combed GUIDs.  We&#039;ve seen similar performance to LONGs in SQL Server (similar, but not equal).  IIRC, MS is putting some more effort into the GUID keys to up their performance.

We did try GUIDs in Oracle once.  We wound up having to sequence the bytes a little differently to get a similar effect.

In the Oracle installs with TB&#039;s of data, they were doing other things to help with performance, such as creating clusters based on dates, etc.  Of course, that was because we made the mistake of letting the business use our OLTP DB as their reporting DB, but that&#039;s another story...</description>
		<content:encoded><![CDATA[<p>@Lars</p>
<p>That&#8217;s why we use the combed GUIDs.  We&#8217;ve seen similar performance to LONGs in SQL Server (similar, but not equal).  IIRC, MS is putting some more effort into the GUID keys to up their performance.</p>
<p>We did try GUIDs in Oracle once.  We wound up having to sequence the bytes a little differently to get a similar effect.</p>
<p>In the Oracle installs with TB&#8217;s of data, they were doing other things to help with performance, such as creating clusters based on dates, etc.  Of course, that was because we made the mistake of letting the business use our OLTP DB as their reporting DB, but that&#8217;s another story&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Stouffer</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-568</link>
		<dc:creator>Mark Stouffer</dc:creator>
		<pubDate>Sat, 07 Jun 2008 18:28:19 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-568</guid>
		<description>Overloaded fields suck in general, but especially when it is the join keys in a many-to-many relationship table. I use auto-increment keys in most tables just because testing selects by typeing or copying a guid is a bit of a constant hassle durring development.</description>
		<content:encoded><![CDATA[<p>Overloaded fields suck in general, but especially when it is the join keys in a many-to-many relationship table. I use auto-increment keys in most tables just because testing selects by typeing or copying a guid is a bit of a constant hassle durring development.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Saggett</title>
		<link>http://lostechies.com/jimmybogard/2008/06/05/designing-primary-keys/#comment-567</link>
		<dc:creator>Bob Saggett</dc:creator>
		<pubDate>Sat, 07 Jun 2008 18:08:04 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2008/06/04/designing-primary-keys.aspx#comment-567</guid>
		<description>Your article makes some valid points but appears to be completely biased to your personal viewpoint.  There are good, and bad, reasons for using surrogate keys and good, and bad, reasons for using other options.

One point worthy of mention.  You talk about the &quot;COMB&quot; GUIDs in close proximity to talking about GUIDs being globally unique.  A simply mathematical exercise will show that there is MORE chance of the COMB GUIDs being non-unique on the global scale than those generated by other methods.  The linked article makes the point of it being difficult to create a million GUIDs in less than 1/300th of a second.  However, on a global scale or, in fact, in a large organisation with many hundreds of replicated servers, the overall grid may produce many more GUIDs in this amount of time.  This would still give a low chance of collision but not as low as a good GUID algorithm.

It is interesting to note that Microsoft&#039;s preferred algorithm is simply a completely random number (or as random as a computer can be).</description>
		<content:encoded><![CDATA[<p>Your article makes some valid points but appears to be completely biased to your personal viewpoint.  There are good, and bad, reasons for using surrogate keys and good, and bad, reasons for using other options.</p>
<p>One point worthy of mention.  You talk about the &#8220;COMB&#8221; GUIDs in close proximity to talking about GUIDs being globally unique.  A simply mathematical exercise will show that there is MORE chance of the COMB GUIDs being non-unique on the global scale than those generated by other methods.  The linked article makes the point of it being difficult to create a million GUIDs in less than 1/300th of a second.  However, on a global scale or, in fact, in a large organisation with many hundreds of replicated servers, the overall grid may produce many more GUIDs in this amount of time.  This would still give a low chance of collision but not as low as a good GUID algorithm.</p>
<p>It is interesting to note that Microsoft&#8217;s preferred algorithm is simply a completely random number (or as random as a computer can be).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
