You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Over in dm_exec_plan_attributes there's an attribute called optional_spid which populates under certain circumstances with temp table use.
We can use it to detect a form of plan cache pollution from #temp table use. I have a blog post scheduled about it. I'll update this issue with the link when it goes live.
Describe the solution you'd like
Look for entries in dm_exec_plan_attributes where optional_spid is populated with a > 0 value, and get a count of them to compare to total plans. I'm not sure about a threshold to warn about yet, and I'm not sure how common the problem is, but hey. Maybe one of you smart folks does?
Describe alternatives you've considered
Becoming a backup dancer for Lenny and the Squigtones.
Are you ready to build the code for the feature?
Obvs.
The text was updated successfully, but these errors were encountered:
erikdarlingdata
changed the title
sp_BlitzCache - Look for plan cache pollution from temp tables
sp_BlitzCache - Look for plan cache pollution from optional SPIDs
Nov 29, 2021
I have almost all Azure SQL Databases and in spot checking a few, I see as many as thousands of rows returned by your query. Looking at a sampling of the query plans (by adding "CROSS APPLY sys.dm_exec_query_plan(decp.plan_handle) as deqp" to the FROM and "deqp.query_plan" to the SELECT), they all seem to be from Microsoft analyzing various things with queries I can't run because they use three part names.
I haven't caught one yet that came from a user stored procedure, but I haven't looked at anywhere near a reasonable sampling of these plans yet either.
Is your feature request related to a problem? Please describe.
Over in dm_exec_plan_attributes there's an attribute called optional_spid which populates under certain circumstances with temp table use.
It has been around since at least SQL Server 2008, but it was only documented recently. Thank you @WilliamDAssafMSFT for that!
We can use it to detect a form of plan cache pollution from #temp table use. I have a blog post scheduled about it. I'll update this issue with the link when it goes live.
Describe the solution you'd like
Look for entries in dm_exec_plan_attributes where optional_spid is populated with a > 0 value, and get a count of them to compare to total plans. I'm not sure about a threshold to warn about yet, and I'm not sure how common the problem is, but hey. Maybe one of you smart folks does?
Describe alternatives you've considered
Becoming a backup dancer for Lenny and the Squigtones.
Are you ready to build the code for the feature?
Obvs.
The text was updated successfully, but these errors were encountered: