<?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: When to use surrogate keys in InnoDB tables</title>
	<atom:link href="http://www.xaprb.com/blog/2006/05/10/when-to-avoid-and-when-to-use-surrogate-keys-in-innodb-tables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog/2006/05/10/when-to-avoid-and-when-to-use-surrogate-keys-in-innodb-tables/</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 20:41:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Vineet</title>
		<link>http://www.xaprb.com/blog/2006/05/10/when-to-avoid-and-when-to-use-surrogate-keys-in-innodb-tables/#comment-19168</link>
		<dc:creator>Vineet</dc:creator>
		<pubDate>Sun, 20 Feb 2011 07:49:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=128#comment-19168</guid>
		<description>(typo)

primary key(fk_author_id , blog_id),

would be

primary key(fk_blogger_id , blog_id),</description>
		<content:encoded><![CDATA[<p>(typo)</p>
<p>primary key(fk_author_id , blog_id),</p>
<p>would be</p>
<p>primary key(fk_blogger_id , blog_id),</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vineet</title>
		<link>http://www.xaprb.com/blog/2006/05/10/when-to-avoid-and-when-to-use-surrogate-keys-in-innodb-tables/#comment-19167</link>
		<dc:creator>Vineet</dc:creator>
		<pubDate>Sun, 20 Feb 2011 06:51:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=128#comment-19167</guid>
		<description>This was really very helpful.
But I have some doubt about the benchmark by Murray.
What if the table is like this

create table blog(
fk_blogger_id int(10),
blog_id int(10) auto_increment,
....other columns,
primary key(fk_author_id , blog_id),
unique key (blog_id),
foreign key (fk_blogger_id) references blogger(blogger_id)
) ENGINE=InnoDB;

&quot;blogger&quot; is a separate table of bloggers.

Now, say i have say 1-2 blog inserts every second posted by a random bloggers.
would it be a efficient table design?
I would prefer this design as it groups blogs per blogger. Direct access of a blog will use the unique index of blog_id and that would result in two index lookups. But as i would show other blogs of same blogger on the page, The grouping would speed up the overall efficiency.

Am I thinking right? are there any benchmarks around similar solution

great stuff though!</description>
		<content:encoded><![CDATA[<p>This was really very helpful.<br />
But I have some doubt about the benchmark by Murray.<br />
What if the table is like this</p>
<p>create table blog(<br />
fk_blogger_id int(10),<br />
blog_id int(10) auto_increment,<br />
&#8230;.other columns,<br />
primary key(fk_author_id , blog_id),<br />
unique key (blog_id),<br />
foreign key (fk_blogger_id) references blogger(blogger_id)<br />
) ENGINE=InnoDB;</p>
<p>&#8220;blogger&#8221; is a separate table of bloggers.</p>
<p>Now, say i have say 1-2 blog inserts every second posted by a random bloggers.<br />
would it be a efficient table design?<br />
I would prefer this design as it groups blogs per blogger. Direct access of a blog will use the unique index of blog_id and that would result in two index lookups. But as i would show other blogs of same blogger on the page, The grouping would speed up the overall efficiency.</p>
<p>Am I thinking right? are there any benchmarks around similar solution</p>
<p>great stuff though!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Kamins</title>
		<link>http://www.xaprb.com/blog/2006/05/10/when-to-avoid-and-when-to-use-surrogate-keys-in-innodb-tables/#comment-17227</link>
		<dc:creator>Dan Kamins</dc:creator>
		<pubDate>Wed, 04 Nov 2009 08:47:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=128#comment-17227</guid>
		<description>Fantastic article.  Your comment about &quot;page splits and b-tree re-balancings&quot; on inserts would be a great addition to the main text and was very helpful for me.</description>
		<content:encoded><![CDATA[<p>Fantastic article.  Your comment about &#8220;page splits and b-tree re-balancings&#8221; on inserts would be a great addition to the main text and was very helpful for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Phillips</title>
		<link>http://www.xaprb.com/blog/2006/05/10/when-to-avoid-and-when-to-use-surrogate-keys-in-innodb-tables/#comment-14075</link>
		<dc:creator>David Phillips</dc:creator>
		<pubDate>Mon, 10 Dec 2007 22:17:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=128#comment-14075</guid>
		<description>Murray,

As Xaprb said, your second insert is slow because you are inserting in a random order.  Before loading, sort your data in primary key order and the two inserts should run in similar time.</description>
		<content:encoded><![CDATA[<p>Murray,</p>
<p>As Xaprb said, your second insert is slow because you are inserting in a random order.  Before loading, sort your data in primary key order and the two inserts should run in similar time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus Schwartz &#187; Blog Archive &#187; Optimizing MySQL Indexes</title>
		<link>http://www.xaprb.com/blog/2006/05/10/when-to-avoid-and-when-to-use-surrogate-keys-in-innodb-tables/#comment-13731</link>
		<dc:creator>Marcus Schwartz &#187; Blog Archive &#187; Optimizing MySQL Indexes</dc:creator>
		<pubDate>Fri, 30 Nov 2007 18:49:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=128#comment-13731</guid>
		<description>[...] older article from the same site provides a bit more [...]</description>
		<content:encoded><![CDATA[<p>[...] older article from the same site provides a bit more [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

