<?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: Seek or scan?</title>
	<atom:link href="http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/</link>
	<description>A discussion on SQL Server</description>
	<lastBuildDate>Mon, 30 Jan 2012 12:44:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Performace Tuning Stored Procedures &#171; SQL Canada</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-1932</link>
		<dc:creator>Performace Tuning Stored Procedures &#171; SQL Canada</dc:creator>
		<pubDate>Wed, 21 Dec 2011 15:50:09 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-1932</guid>
		<description>[...] Link. [3] Bell Curve. Wikipedia. Link. [4] Seek or Scan?. Microsoft SQL Server MVP, Gail Shaw. Link. [5] Dissecting SQL Server Execution Plans, Grant Fritchey. Link.  Rate this:  Share [...]</description>
		<content:encoded><![CDATA[<p>[...] Link. [3] Bell Curve. Wikipedia. Link. [4] Seek or Scan?. Microsoft SQL Server MVP, Gail Shaw. Link. [5] Dissecting SQL Server Execution Plans, Grant Fritchey. Link.  Rate this:  Share [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NInja Rg'Rus</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-1775</link>
		<dc:creator>NInja Rg'Rus</dc:creator>
		<pubDate>Mon, 15 Aug 2011 16:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-1775</guid>
		<description>A very interesting post on the same subject by Kimberly Tripp.

http://www.sqlskills.com/BLOGS/KIMBERLY/post/The-Tipping-Point-Query-Answers.aspx</description>
		<content:encoded><![CDATA[<p>A very interesting post on the same subject by Kimberly Tripp.</p>
<p><a href="http://www.sqlskills.com/BLOGS/KIMBERLY/post/The-Tipping-Point-Query-Answers.aspx" rel="nofollow">http://www.sqlskills.com/BLOGS/KIMBERLY/post/The-Tipping-Point-Query-Answers.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-250</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Wed, 16 Jun 2010 21:49:35 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-250</guid>
		<description>Any thoughts on this related post on Stack Overflow?  Mike M. referenced this article, but at this time of writing, we&#039;re still a little confused ...

http://stackoverflow.com/questions/3056321/sql-2005-indexed-queries-slower-than-unindexed-queries</description>
		<content:encoded><![CDATA[<p>Any thoughts on this related post on Stack Overflow?  Mike M. referenced this article, but at this time of writing, we&#8217;re still a little confused &#8230;</p>
<p><a href="http://stackoverflow.com/questions/3056321/sql-2005-indexed-queries-slower-than-unindexed-queries" rel="nofollow">http://stackoverflow.com/questions/3056321/sql-2005-indexed-queries-slower-than-unindexed-queries</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-249</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Thu, 16 Apr 2009 08:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-249</guid>
		<description>No. It&#039;s because the ID column is part of that nonclustered index. ID is the clustered index key and hence is part of all nonclustered indexes because it&#039;s the row&#039;s address. (see - http://sqlinthewild.co.za/index.php/2009/02/09/all-indexes-are-unique/)

So your query with ID and SomeNumber was reading a covering nonclustered index.</description>
		<content:encoded><![CDATA[<p>No. It&#8217;s because the ID column is part of that nonclustered index. ID is the clustered index key and hence is part of all nonclustered indexes because it&#8217;s the row&#8217;s address. (see &#8211; <a href="http://sqlinthewild.co.za/index.php/2009/02/09/all-indexes-are-unique/" rel="nofollow">http://sqlinthewild.co.za/index.php/2009/02/09/all-indexes-are-unique/</a>)</p>
<p>So your query with ID and SomeNumber was reading a covering nonclustered index.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cedric</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-248</link>
		<dc:creator>Cedric</dc:creator>
		<pubDate>Wed, 15 Apr 2009 23:56:23 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-248</guid>
		<description>Sorry I should have specifically mentioned that I was refering to the index defined as  : CREATE NonCLUSTERED INDEX [idx_SeekOrScan] ON [dbo].[SeekOrScan] (SomeNumber) my tiping point seems to different than yours.I need more information in this regard.I will do some more investigation .

Agreed that if you add the INCLUDE (id, padding) that a non clustered index seek will be used.

I should have maybe worded my post differently . If I include the SomeNumber field explicitly  in my select list as the only field then the non clustered index seems to be covering even if I add the ID field it still used the non clustered index seek ,but as soon as I add the padding field the query plan swings around to a clustered index scan

Does all this mean that depeinding on your select list that the tipping point can potentially be different if you explicitly state your field list ?</description>
		<content:encoded><![CDATA[<p>Sorry I should have specifically mentioned that I was refering to the index defined as  : CREATE NonCLUSTERED INDEX [idx_SeekOrScan] ON [dbo].[SeekOrScan] (SomeNumber) my tiping point seems to different than yours.I need more information in this regard.I will do some more investigation .</p>
<p>Agreed that if you add the INCLUDE (id, padding) that a non clustered index seek will be used.</p>
<p>I should have maybe worded my post differently . If I include the SomeNumber field explicitly  in my select list as the only field then the non clustered index seems to be covering even if I add the ID field it still used the non clustered index seek ,but as soon as I add the padding field the query plan swings around to a clustered index scan</p>
<p>Does all this mean that depeinding on your select list that the tipping point can potentially be different if you explicitly state your field list ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-247</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Wed, 18 Mar 2009 14:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-247</guid>
		<description>Cedric, are you saying that if I create an index (SomeNumber) INCLUDE (id, padding) and then run &quot;select * from [SeekOrScan]  where somenumber between 1 and 50000&quot; that I&#039;ll still get a clustered index scan?

Sure, if you just specify the indexes column in the select it will be an index seek, because no bookmark lookup is required, the index alone can satisfy the query. It&#039;s only when there&#039;s a bookmark lookup that there&#039;s a &#039;tipping point&#039;</description>
		<content:encoded><![CDATA[<p>Cedric, are you saying that if I create an index (SomeNumber) INCLUDE (id, padding) and then run &#8220;select * from [SeekOrScan]  where somenumber between 1 and 50000&#8243; that I&#8217;ll still get a clustered index scan?</p>
<p>Sure, if you just specify the indexes column in the select it will be an index seek, because no bookmark lookup is required, the index alone can satisfy the query. It&#8217;s only when there&#8217;s a bookmark lookup that there&#8217;s a &#8216;tipping point&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cedric</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-246</link>
		<dc:creator>Cedric</dc:creator>
		<pubDate>Wed, 18 Mar 2009 12:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-246</guid>
		<description>Even creating a covering index in this instance will still yield a clustered index scan if the columns on which the covering index are defined is not part explicitly stated in the SELECT  clause ,until the point where the ratio of rows like Gail illustrated above is reached.

If we changed one of  the statements above to :

select somenumber from [SeekOrScan]
where somenumber between 1 and 50000

Then we see a non clustered index seek</description>
		<content:encoded><![CDATA[<p>Even creating a covering index in this instance will still yield a clustered index scan if the columns on which the covering index are defined is not part explicitly stated in the SELECT  clause ,until the point where the ratio of rows like Gail illustrated above is reached.</p>
<p>If we changed one of  the statements above to :</p>
<p>select somenumber from [SeekOrScan]<br />
where somenumber between 1 and 50000</p>
<p>Then we see a non clustered index seek</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Now syndicating Gail Shaw and Kendal Van Dyke &#124; Brent Ozar - SQL Server DBA</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-245</link>
		<dc:creator>Now syndicating Gail Shaw and Kendal Van Dyke &#124; Brent Ozar - SQL Server DBA</dc:creator>
		<pubDate>Tue, 10 Feb 2009 23:11:12 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-245</guid>
		<description>[...] Seek or scan? - how does SQL Server determine when to pick one over the other? [...]</description>
		<content:encoded><![CDATA[<p>[...] Seek or scan? &#8211; how does SQL Server determine when to pick one over the other? [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Stobbs</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-244</link>
		<dc:creator>Christopher Stobbs</dc:creator>
		<pubDate>Mon, 26 Jan 2009 09:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-244</guid>
		<description>he he he Yip SP1, I&#039;ve tried it on another machine and it all seems good :-) thanks for that</description>
		<content:encoded><![CDATA[<p>he he he Yip SP1, I&#8217;ve tried it on another machine and it all seems good <img src='http://sqlinthewild.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  thanks for that</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/01/09/seek-or-scan/comment-page-1/#comment-243</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Fri, 23 Jan 2009 16:26:35 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=166#comment-243</guid>
		<description>Let me guess, SQL 2005 RTM or SP1?

The operator was called a bookmark lookup in SQL 2000 and before. In SQL 2005 SP2 and later it was a key lookup.

In SQL 2005 RTM and SP1 it appeared as a clustered index seek, and hence often went unnoticed (because clustered index seeks are good)</description>
		<content:encoded><![CDATA[<p>Let me guess, SQL 2005 RTM or SP1?</p>
<p>The operator was called a bookmark lookup in SQL 2000 and before. In SQL 2005 SP2 and later it was a key lookup.</p>
<p>In SQL 2005 RTM and SP1 it appeared as a clustered index seek, and hence often went unnoticed (because clustered index seeks are good)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

