<?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: Multiple Execution Paths</title>
	<atom:link href="http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/</link>
	<description>A discussion on SQL Server</description>
	<lastBuildDate>Mon, 14 May 2012 23:51:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-1979</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Thu, 16 Feb 2012 14:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-1979</guid>
		<description>Yes, but.... 

By doing that you get a plan for the average case, not necessarily the best case. 
http://sqlinthewild.co.za/index.php/2008/02/25/parameter-sniffing-pt-2/</description>
		<content:encoded><![CDATA[<p>Yes, but&#8230;. </p>
<p>By doing that you get a plan for the average case, not necessarily the best case.<br />
<a href="http://sqlinthewild.co.za/index.php/2008/02/25/parameter-sniffing-pt-2/" rel="nofollow">http://sqlinthewild.co.za/index.php/2008/02/25/parameter-sniffing-pt-2/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: suresh</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-1978</link>
		<dc:creator>suresh</dc:creator>
		<pubDate>Thu, 16 Feb 2012 14:34:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-1978</guid>
		<description>Hi Gail
Since it&#039;s an onld post, I am not sure if it will be replied. But I do remember using and reading somewhere that to avoid parameter sniffinf, we can receive the passed parameters in variables declared inside the proc and then use those variables instead of hardcoaded values. Isn&#039;t that true? Use of seprate proc for each IF statement somewhat looks intimidating to me if my proc has many if statements.</description>
		<content:encoded><![CDATA[<p>Hi Gail<br />
Since it&#8217;s an onld post, I am not sure if it will be replied. But I do remember using and reading somewhere that to avoid parameter sniffinf, we can receive the passed parameters in variables declared inside the proc and then use those variables instead of hardcoaded values. Isn&#8217;t that true? Use of seprate proc for each IF statement somewhat looks intimidating to me if my proc has many if statements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-1217</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Wed, 15 Dec 2010 05:48:39 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-1217</guid>
		<description>As always, it depends. :-)

If a proc is running many times a second you do not want it recompiling on each execution. The overhead will be unpleasant. If the proc is running once a day the recompile overhead is far less of a problem.</description>
		<content:encoded><![CDATA[<p>As always, it depends. <img src='http://sqlinthewild.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>If a proc is running many times a second you do not want it recompiling on each execution. The overhead will be unpleasant. If the proc is running once a day the recompile overhead is far less of a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-1210</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Tue, 14 Dec 2010 22:26:58 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-1210</guid>
		<description>I worry about the recompile option because in a high load (hundred calls per sec) the time and processor spent to recompile could be big ( agree or not ?!). 
The option to have more procedures is the right choice IMO.</description>
		<content:encoded><![CDATA[<p>I worry about the recompile option because in a high load (hundred calls per sec) the time and processor spent to recompile could be big ( agree or not ?!).<br />
The option to have more procedures is the right choice IMO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tsquare</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-538</link>
		<dc:creator>Tsquare</dc:creator>
		<pubDate>Fri, 05 Mar 2010 23:07:49 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-538</guid>
		<description>Great Blog!......There&#039;s always something here to make me laugh...Keep doing what ya do :)</description>
		<content:encoded><![CDATA[<p>Great Blog!&#8230;&#8230;There&#8217;s always something here to make me laugh&#8230;Keep doing what ya do <img src='http://sqlinthewild.co.za/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-537</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Mon, 07 Dec 2009 15:23:37 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-537</guid>
		<description>If you&#039;ve got a proc with multiple if-else branches, based of multiple parameters then you are probably way better off breaking it down into multiple smaller procs. Not sure why you&#039;re concerned with the numbers, the same number queries would exist in the single proc, it&#039;s just a matter of moving them elsewhere.</description>
		<content:encoded><![CDATA[<p>If you&#8217;ve got a proc with multiple if-else branches, based of multiple parameters then you are probably way better off breaking it down into multiple smaller procs. Not sure why you&#8217;re concerned with the numbers, the same number queries would exist in the single proc, it&#8217;s just a matter of moving them elsewhere.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aalamjeet Singh</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-536</link>
		<dc:creator>Aalamjeet Singh</dc:creator>
		<pubDate>Mon, 07 Dec 2009 14:26:54 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-536</guid>
		<description>What happens if the there are more than one parameters which can have multiple combinations of values while calling the master proc? We can&#039;t have n child procs for n number of combinations if n is a large number!</description>
		<content:encoded><![CDATA[<p>What happens if the there are more than one parameters which can have multiple combinations of values while calling the master proc? We can&#8217;t have n child procs for n number of combinations if n is a large number!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-535</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Sat, 10 Oct 2009 08:48:13 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-535</guid>
		<description>Bear in mind this was a simplified example. It&#039;s possible to get this problem when all indexes are covering, eg through inappropriate joins or other operators. It&#039;s not just an indexing question.

It&#039;s just a bit harder to generate such an example, which is why I stuck to something simple.</description>
		<content:encoded><![CDATA[<p>Bear in mind this was a simplified example. It&#8217;s possible to get this problem when all indexes are covering, eg through inappropriate joins or other operators. It&#8217;s not just an indexing question.</p>
<p>It&#8217;s just a bit harder to generate such an example, which is why I stuck to something simple.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-534</link>
		<dc:creator>Troy</dc:creator>
		<pubDate>Fri, 09 Oct 2009 21:38:46 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-534</guid>
		<description>Thanks for the additional information about the index. I had guessed that there must be one in your example, and defined one that used the TransactionType for the index key, but additionally included the TransactionDate. This has the effect of eliminating the key lookup in the suboptimal plan, so the reads don&#039;t go through the roof as in your example.

So the 2nd recommendation that I hope your readers will keep in mind is to be sure your indexing design is optimal for the types of queries you&#039;re running.</description>
		<content:encoded><![CDATA[<p>Thanks for the additional information about the index. I had guessed that there must be one in your example, and defined one that used the TransactionType for the index key, but additionally included the TransactionDate. This has the effect of eliminating the key lookup in the suboptimal plan, so the reads don&#8217;t go through the roof as in your example.</p>
<p>So the 2nd recommendation that I hope your readers will keep in mind is to be sure your indexing design is optimal for the types of queries you&#8217;re running.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gail</title>
		<link>http://sqlinthewild.co.za/index.php/2009/09/15/multiple-execution-paths/comment-page-1/#comment-533</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Thu, 08 Oct 2009 16:05:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlinthewild.co.za/?p=284#comment-533</guid>
		<description>SQL 2008. 2005 behaves exactly the same way. I did this as a presentation, used SQL 2008 twice and 2005 once.

The point is not avoiding recompiles, the point is that SQL doesn&#039;t recompile and continues using a cached plan even in cases when it&#039;s highly inefficient.

Make sure there is an index on TransactionType. I&#039;m not sure if there&#039;s one on that column in the default adventureworks. Without an index, you&#039;ll get a tablescan no matter what because there&#039;s no other way to evaluate the query
USE [Adventureworks]
GO
CREATE NONCLUSTERED INDEX [IX_TransactionHistory_TransactionType] ON [Production].[TransactionHistory]
([TransactionType] ASC)</description>
		<content:encoded><![CDATA[<p>SQL 2008. 2005 behaves exactly the same way. I did this as a presentation, used SQL 2008 twice and 2005 once.</p>
<p>The point is not avoiding recompiles, the point is that SQL doesn&#8217;t recompile and continues using a cached plan even in cases when it&#8217;s highly inefficient.</p>
<p>Make sure there is an index on TransactionType. I&#8217;m not sure if there&#8217;s one on that column in the default adventureworks. Without an index, you&#8217;ll get a tablescan no matter what because there&#8217;s no other way to evaluate the query<br />
USE [Adventureworks]<br />
GO<br />
CREATE NONCLUSTERED INDEX [IX_TransactionHistory_TransactionType] ON [Production].[TransactionHistory]<br />
([TransactionType] ASC)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

