<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx</link><description>One of the things that separates a good programmer from a great one is a firm understanding about what is going on inside the computer. For some programming languages, it is very obvious what is going on inside the computer because you are working at</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>re: One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx#47258</link><pubDate>Wed, 23 Jan 2013 12:49:51 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47258</guid><dc:creator>SQLChap</dc:creator><description>&lt;p&gt;I've seen that issue with dateadd happening even when you have the where clause in place. The same reason in that it was completing the dateadd function first before computing the where criteria.&lt;/p&gt;</description></item><item><title>re: One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx#47264</link><pubDate>Wed, 23 Jan 2013 16:30:16 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47264</guid><dc:creator>drsql</dc:creator><description>&lt;p&gt;SQLChap: Good point that I will add tonight when I am at my writing computer :) &amp;nbsp;One thing to note is that putting the criteria in the JOIN criteria is probably a good bit safer than in the WHERE clause. In the JOIN criteria, it is defining the set and is definitely going to be applied as you expect. &amp;nbsp;In the WHERE clause, other JOINs (particularly any OUTER JOINS) could be dictating that the criteria not be applied until later in the plan.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx#47326</link><pubDate>Sat, 26 Jan 2013 21:13:42 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47326</guid><dc:creator>Russell Tye</dc:creator><description>&lt;p&gt;Hi Louis,&lt;/p&gt;
&lt;p&gt;Thanks for sharing. That was a great demo. I started reading Grant Fritchey's book about two weeks. I strongly recommend it also. It should be required reading for all SQL developers DBAs.&lt;/p&gt;</description></item><item><title>re: One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx#47333</link><pubDate>Sun, 27 Jan 2013 12:13:12 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47333</guid><dc:creator>Tom</dc:creator><description>&lt;p&gt;Hi Russell,&lt;/p&gt;
&lt;p&gt;Which of Grants book ?&lt;/p&gt;</description></item><item><title>re: One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx#47362</link><pubDate>Mon, 28 Jan 2013 18:15:53 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47362</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;Couldn't you use a CASE clause instead?&lt;/p&gt;
&lt;p&gt;select *, &lt;/p&gt;
&lt;p&gt;case when date.dateValue &amp;lt; '9999-12-31' then dateadd(day, 1, date.dateValue) end&lt;/p&gt;
&lt;p&gt;from ExampleTable&lt;/p&gt;
&lt;p&gt;join date&lt;/p&gt;
&lt;p&gt;on date.dateValue = ExampleTable.dateValue&lt;/p&gt;</description></item><item><title>re: One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx#47365</link><pubDate>Mon, 28 Jan 2013 18:58:12 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47365</guid><dc:creator>drsql</dc:creator><description>&lt;p&gt;Richard:&lt;/p&gt;
&lt;p&gt;Good point, that too would solve the issue with the overflow, would produce the same results, though the same query plan. I would probably try the JOIN ON criteria first if I were dealing with an issue as it hits at the root of the problem, but in any case, the plan can help guide you the &amp;quot;best&amp;quot; solution in your case.&lt;/p&gt;
</description></item><item><title>re: One more reason to to understand query plans, not directly performance related</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2013/01/22/one-more-reason-to-to-understand-query-plans-not-directly-performance-related.aspx#47708</link><pubDate>Wed, 13 Feb 2013 19:02:38 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:47708</guid><dc:creator>Don</dc:creator><description>&lt;p&gt;A scalar function operates on 1 row at a time. It is much better to operate on sets of data instead of 1 row at time. This can be done by generating a temp or table variable with a computed column containing the data in the form you want. Then you can select off that table. By removing the row processing you increase performance.&lt;/p&gt;</description></item></channel></rss>