<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>4.0 Useful Queries on DMV’s to understand Plan Cache Behavior</title><link>http://blogs.msdn.com/sqlprogrammability/archive/2007/01/23/4-0-useful-queries-on-dmv-s-to-understand-plan-cache-behavior.aspx</link><description>The following queries can be used to understand plan cache behavior. It should be noted that for systems with large plan caches, selecting all rows and joining with sys.dm_exec_sql_text is not recommended. To find the size of the plan cache use: select</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Forced parameterization not effecient</title><link>http://blogs.msdn.com/sqlprogrammability/archive/2007/01/23/4-0-useful-queries-on-dmv-s-to-understand-plan-cache-behavior.aspx#2112699</link><pubDate>Fri, 13 Apr 2007 13:03:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2112699</guid><dc:creator>Cine</dc:creator><description>&lt;p&gt;We have forced parameterization enabled since we were having big problems with almost identical queries there were not simple enough for the simple parameterization to work. But we are still getting a ton of plans that are not being parameterized&lt;/p&gt;
&lt;p&gt;select count(*) from sys.dm_exec_cached_plans cp&lt;/p&gt;
&lt;p&gt;select count(*) from sys.dm_Exec_Cached_plans where cacheobjtype = 'Compiled Plan'&lt;/p&gt;
&lt;p&gt;select count(*) from sys.dm_Exec_Cached_plans where cacheobjtype = 'Compiled Plan' and objtype = 'Adhoc'&lt;/p&gt;
&lt;p&gt;select count(*) from sys.dm_Exec_Cached_plans where cacheobjtype = 'Compiled Plan' and objtype = 'Prepared' &lt;/p&gt;
&lt;p&gt;Returns 23283, 23163, 21879 and 1245 respectively.&lt;/p&gt;
&lt;p&gt;Any clue as to why it does this? I can see many of the queries should be very simple to parameterize.&lt;/p&gt;
&lt;p&gt;Another questions is, why is the dbid of the sys.dm_exec_cached_plans always null. It makes it very hard to track down things when you have multiple db on the same machine.&lt;/p&gt;</description></item><item><title>re: 4.0 Useful Queries on DMV’s to understand Plan Cache Behavior</title><link>http://blogs.msdn.com/sqlprogrammability/archive/2007/01/23/4-0-useful-queries-on-dmv-s-to-understand-plan-cache-behavior.aspx#2119644</link><pubDate>Fri, 13 Apr 2007 23:18:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2119644</guid><dc:creator>sangeethashekar</dc:creator><description>&lt;p&gt;Thank you for bringing this to our attention. I would be happy to work with you to learn more about the nature of queries in your workload/application and investigate why forced parameterization does not work for you. Please send me email at sshekar@microsoft.com&lt;/p&gt;
</description></item><item><title>Reset cached plan - how to and what to?</title><link>http://blogs.msdn.com/sqlprogrammability/archive/2007/01/23/4-0-useful-queries-on-dmv-s-to-understand-plan-cache-behavior.aspx#2621918</link><pubDate>Mon, 14 May 2007 12:55:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2621918</guid><dc:creator>SQL Server Performance and Tuning - (SSQA)</dc:creator><description>&lt;p&gt;I don't believe you would need to reset the cache on a production server, it is not a best practice to&lt;/p&gt;
</description></item><item><title>More TokenAndPermUserStore</title><link>http://blogs.msdn.com/sqlprogrammability/archive/2007/01/23/4-0-useful-queries-on-dmv-s-to-understand-plan-cache-behavior.aspx#3953313</link><pubDate>Thu, 19 Jul 2007 13:10:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3953313</guid><dc:creator>Grumpy Old DBA</dc:creator><description>&lt;p&gt;I was interested in Jasper’s post &lt;a rel="nofollow" target="_new" href="http://sqlblogcasts.com/blogs/sqldbatips/archive/2007/07/18/troubleshooting-performance-issues-with-tokenandpermuserstore-in-sql2005.aspx?CommentPosted=true#commentmessage"&gt;http://sqlblogcasts.com/blogs/sqldbatips/archive/2007/07/18/troubleshooting-performance-issues-with-tokenandpermuserstore-in-sql2005.aspx?CommentPosted=true#commentmessage&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>