SQL-Server-First-Responder-Kit
SQL-Server-First-Responder-Kit copied to clipboard
sp_BlitzCache: SQL Server 2022 compat level breaks statement tracking
Version of the script SELECT @Version = '8.09', @VersionDate = '20220408';
What is the current behavior?
In database compat levels 150 (2019) and prior, if you run sp_BlitzCache, you can see where a statement comes from:
In compat level 160 (2022), you cannot:
In addition, if you click on the plan for the stored procedure, you just see a "multiple plan" operator, which isn't useful:
If the current behavior is a bug, please provide the steps to reproduce. It's not really a bug in sp_BlitzCache, but just something we're going to have to think about if they actually try to ship SQL Server 2022 in this sad state, so here goes:
USE StackOverflow2013;
GO
CREATE INDEX Reputation ON dbo.Users(Reputation);
GO
CREATE OR ALTER PROCEDURE dbo.usp_UsersByReputation
@Reputation int
AS
SELECT TOP 10000 *
FROM dbo.Users
WHERE Reputation=@Reputation
ORDER BY DisplayName;
GO
ALTER DATABASE CURRENT SET COMPATIBILITY_LEVEL = 150;
GO
EXEC dbo.usp_UsersByReputation @Reputation =1;
GO
sp_BlitzCache;
GO
ALTER DATABASE CURRENT SET COMPATIBILITY_LEVEL = 160;
GO
EXEC dbo.usp_UsersByReputation @Reputation =1;
GO
sp_BlitzCache;
What is the expected behavior? It's early in the design process, but depending on how Microsoft decides to ship the final product, we might have to:
- Build in warnings about why we can't tell which statements are from which procs
- Build a different way of doing this altogether