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
Version of the script
SELECT @Version = '7.999', @VersionDate = '20201011';
What is the current behavior?
If I log sp_BlitzCache to a table in a database using the @output... parameters and query that information, the PlanCreationTimeHours computed column will reflect the datediff between the plan creation time and now (SYSDATETIME()) I am not sure this is correct and makes more sense to be compared with CheckDate as this will reflect the Creation age as of that collection time as I may decide to query this information some days later.
Current computed column definition:
PlanCreationTimeHours AS DATEDIFF(HOUR, PlanCreationTime, SYSDATETIME())
If the current behavior is a bug, please provide the steps to reproduce.
You will need to have at least an hours' worth of information logged in the table in order to see the issue.
You can use this query to check the logged information which should show all rows where the computed column states a plan age larger than the actual plan age (Alter object names as required):
SELECT TOP (100) [ID]
,[CheckDate]
,[PlanCreationTime]
,[PlanCreationTimeHours]
,DATEDIFF(HOUR,CAST([PlanCreationTime] AS DATETIMEOFFSET(7)),[CheckDate]) AS [PlanCreationTimeHours_Revision]
FROM [DBA].[dbo].[BlitzCache]
WHERE DATEDIFF(HOUR,CAST([PlanCreationTime] AS DATETIMEOFFSET(7)),[CheckDate]) = 0 /* plan age less than an hour ago at point of collection */
AND CheckDate < DATEADD(HOUR,-1,SYSDATETIMEOFFSET()) /* Collection was more than an hour ago */
AND [PlanCreationTimeHours] > 0 /* Where current column definition states plan age is older than an hour */
ORDER BY ID ASC
What is the expected behavior?
I would expect the plan age to reflect the age at point of collection rather than comparing against the current date/time
Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
I have checked SQL2012 and SQL2016
Happy to pick this up and code the fix if agreed that it is indeed a bug?
Thanks
The text was updated successfully, but these errors were encountered:
BrentOzarULTD#2655 Altered the definition of the PlanCreationTimeHours coumputed column in the output table only.
Old definition:DATEDIFF(HOUR, PlanCreationTime, SYSDATETIME())
New Definition: DATEDIFF(HOUR,CONVERT(DATETIMEOFFSET(7),[PlanCreationTime]),[CheckDate])
Create table statement updated and a new statement added to check the computed column definition, if this differs from the expected then the column is dropped and recreated.
Version of the script
SELECT @Version = '7.999', @VersionDate = '20201011';
What is the current behavior?
If I log sp_BlitzCache to a table in a database using the @output... parameters and query that information, the PlanCreationTimeHours computed column will reflect the datediff between the plan creation time and now (SYSDATETIME()) I am not sure this is correct and makes more sense to be compared with CheckDate as this will reflect the Creation age as of that collection time as I may decide to query this information some days later.
Current computed column definition:
PlanCreationTimeHours AS DATEDIFF(HOUR, PlanCreationTime, SYSDATETIME())
If the current behavior is a bug, please provide the steps to reproduce.
/* log sp_BlitzCache to a table */
You will need to have at least an hours' worth of information logged in the table in order to see the issue.
You can use this query to check the logged information which should show all rows where the computed column states a plan age larger than the actual plan age (Alter object names as required):
What is the expected behavior?
I would expect the plan age to reflect the age at point of collection rather than comparing against the current date/time
Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?
I have checked SQL2012 and SQL2016
Happy to pick this up and code the fix if agreed that it is indeed a bug?
Thanks
The text was updated successfully, but these errors were encountered: