<?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 Less Reading is a Good Thing</title>
	<atom:link href="http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing/feed" rel="self" type="application/rss+xml" />
	<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing</link>
	<description>Jeremiah Peschka&#039;s ruminations on sql, ruby, c# and other things</description>
	<lastBuildDate>Mon, 15 Mar 2010 01:41:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Log Buffer #151: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-630</link>
		<dc:creator>Log Buffer #151: a Carnival of the Vanities for DBAs &#124; Pythian Group Blog</dc:creator>
		<pubDate>Fri, 26 Jun 2009 16:53:51 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-630</guid>
		<description>[...] cool. I learned this from the Fonz. But look at this, Jeremiah Peschka says there are circumstances when less reading is a good thing. I&#8217;m confused! What else does he say? &#8220;Less reading is a good thing when you’re [...]</description>
		<content:encoded><![CDATA[<p>[...] cool. I learned this from the Fonz. But look at this, Jeremiah Peschka says there are circumstances when less reading is a good thing. I&#8217;m confused! What else does he say? &#8220;Less reading is a good thing when you’re [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremiah Peschka</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-620</link>
		<dc:creator>Jeremiah Peschka</dc:creator>
		<pubDate>Fri, 19 Jun 2009 19:33:38 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-620</guid>
		<description>I keep making that argument, but nobody listens to me :)

Also, it is entirely possible, given the way this application is built, for a specific user to have access to 50 states and have that change to 45 states pretty quickly due to changes in security restrictions and also the constant ETL process from the mainframe.

The other issue is that we&#039;d need to cache the state list for each user, because of the security in the app, so it might create some problems with memory use on the web server.</description>
		<content:encoded><![CDATA[<p>I keep making that argument, but nobody listens to me <img src='http://facility9.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Also, it is entirely possible, given the way this application is built, for a specific user to have access to 50 states and have that change to 45 states pretty quickly due to changes in security restrictions and also the constant ETL process from the mainframe.</p>
<p>The other issue is that we&#8217;d need to cache the state list for each user, because of the security in the app, so it might create some problems with memory use on the web server.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michelle Ufford</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-619</link>
		<dc:creator>Michelle Ufford</dc:creator>
		<pubDate>Fri, 19 Jun 2009 19:27:48 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-619</guid>
		<description>Regarding this statement... 

&quot;Considering that this stored procedure gets called thousands and thousands of times a day, that’s a HUGE savings.&quot;

States don&#039;t change very frequently.  Any thought to caching the state list in the application layer and save those 2 reads per 1k+ calls?  :)</description>
		<content:encoded><![CDATA[<p>Regarding this statement&#8230; </p>
<p>&#8220;Considering that this stored procedure gets called thousands and thousands of times a day, that’s a HUGE savings.&#8221;</p>
<p>States don&#8217;t change very frequently.  Any thought to caching the state list in the application layer and save those 2 reads per 1k+ calls?  <img src='http://facility9.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Irving</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-618</link>
		<dc:creator>Andy Irving</dc:creator>
		<pubDate>Fri, 19 Jun 2009 08:34:11 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-618</guid>
		<description>Just to confirm what you said, from http://technet.microsoft.com/en-us/library/ms181151.aspx
In SQL Server Enterprise Edition, the query optimizer automatically considers the indexed view. To use an indexed view in all other editions, the NOEXPAND table hint must be used.

Dennis, i think what you&#039;re seeing is THAT EE will act like it does with filtered indexes in 2008, and consider the indexes for use in the plans (which only happens if you don&#039;t specify noexpand).</description>
		<content:encoded><![CDATA[<p>Just to confirm what you said, from <a href="http://technet.microsoft.com/en-us/library/ms181151.aspx" rel="nofollow">http://technet.microsoft.com/en-us/library/ms181151.aspx</a><br />
In SQL Server Enterprise Edition, the query optimizer automatically considers the indexed view. To use an indexed view in all other editions, the NOEXPAND table hint must be used.</p>
<p>Dennis, i think what you&#8217;re seeing is THAT EE will act like it does with filtered indexes in 2008, and consider the indexes for use in the plans (which only happens if you don&#8217;t specify noexpand).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremiah Peschka</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-616</link>
		<dc:creator>Jeremiah Peschka</dc:creator>
		<pubDate>Thu, 18 Jun 2009 20:55:03 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-616</guid>
		<description>Denis, you have a great point! My view, technically, is bunk without the schema. I&#039;ll change that.

When I ran this on my production instance, I saw the opposite of what you saw and ended up with my code never using the indexed view unless I specified WITH(NOEXPAND). I suspect, though, this may be due to the prevalence of that execution plan in the plan cache.</description>
		<content:encoded><![CDATA[<p>Denis, you have a great point! My view, technically, is bunk without the schema. I&#8217;ll change that.</p>
<p>When I ran this on my production instance, I saw the opposite of what you saw and ended up with my code never using the indexed view unless I specified WITH(NOEXPAND). I suspect, though, this may be due to the prevalence of that execution plan in the plan cache.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLDenis</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-615</link>
		<dc:creator>SQLDenis</dc:creator>
		<pubDate>Thu, 18 Jun 2009 20:29:33 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-615</guid>
		<description>Hey, you forgot to mention the gazillion SET options that have to be supplied to create the view :-)
Also you need dbo.Locations  in the view definition or you can&#039;t create it

just curious, when you run this

SELECT l.ClientID,
       l.[STATE]
FROM Locations AS l
GROUP BY l.ClientId, l.[STATE]



  &#124;--Clustered Index Scan(OBJECT:([tempdb].[dbo].[LocationStates].[CIX_Locations_ClientID_State]))

it uses the view index for me


also running this without a hint

SELECT STATE
   FROM dbo.LocationStates AS x 
  WHERE ClientId = 1;


gets me this plan

  &#124;--Stream Aggregate(GROUP BY:([LocationStates].[STATE]))
       &#124;--Clustered Index Seek(OBJECT:([tempdb].[dbo].[LocationStates].[CIX_Locations_ClientID_State]), 
	SEEK:([LocationStates].[ClientID]=Convert([@1])) ORDERED FORWARD)</description>
		<content:encoded><![CDATA[<p>Hey, you forgot to mention the gazillion SET options that have to be supplied to create the view <img src='http://facility9.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Also you need dbo.Locations  in the view definition or you can&#8217;t create it</p>
<p>just curious, when you run this</p>
<p>SELECT l.ClientID,<br />
       l.[STATE]<br />
FROM Locations AS l<br />
GROUP BY l.ClientId, l.[STATE]</p>
<p>  |&#8211;Clustered Index Scan(OBJECT:([tempdb].[dbo].[LocationStates].[CIX_Locations_ClientID_State]))</p>
<p>it uses the view index for me</p>
<p>also running this without a hint</p>
<p>SELECT STATE<br />
   FROM dbo.LocationStates AS x<br />
  WHERE ClientId = 1;</p>
<p>gets me this plan</p>
<p>  |&#8211;Stream Aggregate(GROUP BY:([LocationStates].[STATE]))<br />
       |&#8211;Clustered Index Seek(OBJECT:([tempdb].[dbo].[LocationStates].[CIX_Locations_ClientID_State]),<br />
	SEEK:([LocationStates].[ClientID]=Convert([@1])) ORDERED FORWARD)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Kline</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-614</link>
		<dc:creator>Kevin Kline</dc:creator>
		<pubDate>Thu, 18 Jun 2009 20:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-614</guid>
		<description>Good tip, Jeremiah!</description>
		<content:encoded><![CDATA[<p>Good tip, Jeremiah!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Bertrand</title>
		<link>http://facility9.com/2009/06/18/when-less-reading-is-a-good-thing#comment-613</link>
		<dc:creator>Aaron Bertrand</dc:creator>
		<pubDate>Thu, 18 Jun 2009 20:10:07 +0000</pubDate>
		<guid isPermaLink="false">http://facility9.com/?p=680#comment-613</guid>
		<description>As an FYI, I have observed at least one case where I had better performance when using NOEXPAND on Enterprise Edition.  I&#039;ll try to dig up the details but IIRC the index on the view was not being chosen.</description>
		<content:encoded><![CDATA[<p>As an FYI, I have observed at least one case where I had better performance when using NOEXPAND on Enterprise Edition.  I&#8217;ll try to dig up the details but IIRC the index on the view was not being chosen.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
