<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Compiled Plan Stub on SQL Server Scripts</title><link>https://www.sqlserver70.com/tags/compiled-plan-stub/</link><description>Recent content in Compiled Plan Stub on SQL Server Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>SQLServer70.com</copyright><lastBuildDate>Thu, 13 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.sqlserver70.com/tags/compiled-plan-stub/index.xml" rel="self" type="application/rss+xml"/><item><title>Find Ad Hoc Plan Cache Bloat with sys.dm_exec_cached_plans</title><link>https://www.sqlserver70.com/post/adhoc-plan-cache-bloat-dm-exec-cached-plans/</link><pubDate>Thu, 13 Aug 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/adhoc-plan-cache-bloat-dm-exec-cached-plans/</guid><description>
&lt;p&gt;Not every plan in SQL Server's cache earns its place. A query compiled once — because its literal values were hard-coded into the text instead of passed as parameters — gets a full compiled plan cached right alongside plans an application reuses thousands of times a day. &lt;a href="https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-objects/sys-dm-exec-cached-plans-transact-sql"&gt;sys.dm_exec_cached_plans&lt;/a&gt; is where that difference becomes measurable: &lt;code&gt;usecounts&lt;/code&gt; shows whether a plan was ever looked up again, and &lt;code&gt;size_in_bytes&lt;/code&gt; shows exactly how many bytes it's still holding in memory for the privilege of never running twice.&lt;/p&gt;</description></item></channel></rss>