<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www2.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>TechEd 2011 - Performance Tuning and Optimization in SQL Server 2008 R2 and SQL Server Code Named &amp;quot;Denali&amp;quot;</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2011/05/18/teched-2011-performance-tuning-and-optimization-in-sql-server-2008-r2-and-sql-server-code-named-denali.aspx</link><description>Thanks to everyone who took the time out of their conference experience to join Mike Wachal and me for yesterday's session on SQL Server performance tuning! For those who weren't there, we focused in on troubleshooting techniques, highlighting some of</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>re: TechEd 2011 - Performance Tuning and Optimization in SQL Server 2008 R2 and SQL Server Code Named "Denali"</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2011/05/18/teched-2011-performance-tuning-and-optimization-in-sql-server-2008-r2-and-sql-server-code-named-denali.aspx#37817</link><pubDate>Mon, 15 Aug 2011 13:56:19 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:37817</guid><dc:creator>Gustavo Ayala</dc:creator><description>&lt;p&gt;I liked your top(@i) trick to lower the memory grant.Overall it's a clean solution.&lt;/p&gt;
&lt;p&gt;I'm looking for the opposite thing.&lt;/p&gt;
&lt;p&gt;Fooling the optimizer into taking a greater memory grant (so as to no spill to tempdb).&lt;/p&gt;
&lt;p&gt;Unfortunately (well maybe not) the query optimizer is smart enough to know that top with a greater value will not &amp;quot;invent rows&amp;quot; out of thin air if the stream below sort (or top actually) doesn't produce them.&lt;/p&gt;
&lt;p&gt;So top won't raise the memory grant. I've tried with union all with something with the same schema and adding varchar columns.&lt;/p&gt;
&lt;p&gt;All ugly solutions (like if there was such thing as a clean solution for this stuff fooling the query optimizer...)&lt;/p&gt;
&lt;p&gt;Do you know a not-so-ugly one ?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
</description></item><item><title>re: TechEd 2011 - Performance Tuning and Optimization in SQL Server 2008 R2 and SQL Server Code Named "Denali"</title><link>http://www2.sqlblog.com/blogs/adam_machanic/archive/2011/05/18/teched-2011-performance-tuning-and-optimization-in-sql-server-2008-r2-and-sql-server-code-named-denali.aspx#37818</link><pubDate>Mon, 15 Aug 2011 14:17:26 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:37818</guid><dc:creator>Adam Machanic</dc:creator><description>&lt;p&gt;Hi Gustavo,&lt;/p&gt;
&lt;p&gt;You're on the right track already, and you're correct that there are not many &amp;quot;not-so-ugly&amp;quot; solutions. Another option is to try OPTIMIZE FOR on something other than the TOP to mess with the seek predicates.&lt;/p&gt;
&lt;p&gt;I'll be covering all of this in gruesome detail in my session at the PASS conference this year, if you'll be attending.&lt;/p&gt;
&lt;p&gt;Best,&lt;/p&gt;
&lt;p&gt;Adam&lt;/p&gt;
</description></item></channel></rss>