sp_QuickieStore not returning expected runtime_stats records
tutuhub opened this issue · 6 comments
Version of the script
@Version = '4.0',
@version_date = '20230801';
What is the current behavior?
Returns one row of data (runtime_stats) for a plan. If we look in the sys.query_store_runtime_stats table we can see that the plan has multiple runtime stats records that fall within the date parameters
If the current behavior is a bug, please provide the steps to reproduce.
Run for any plan that has multiple records in the sys.query_store_runtime_stats table and use parameter @include_plan_ids or @include_query_ids
What is the expected behavior?
Return all runtime_stats data for a given @start_date and @end_date or the default date parameters
Using this on Microsoft SQL Server 2016 (SP3-GDR) (KB5021129) - 13.0.6430.49 (X64)
I figured the problem is with this TOP (1) statement:
DarlingData/sp_QuickieStore/sp_QuickieStore.sql
Line 3526 in a82ae64
@tutuhub Apologies for the delay in response. I just got back from a family vacation.
This is the intended behavior -- return the plan with the highest chosen resource -- I intentionally avoid showing everything from runtime stats. I think in most cases that's exactly what I want.
That being said, there is some conditional logic using the @plans_top
variable for when @include_plan_ids
is used:
DarlingData/sp_QuickieStore/sp_QuickieStore.sql
Line 1024 in a82ae64
DarlingData/sp_QuickieStore/sp_QuickieStore.sql
Line 1160 in a82ae64
DarlingData/sp_QuickieStore/sp_QuickieStore.sql
Line 3674 in a82ae64
I think a reasonable change would be to do something similar with a @queries_top
variable in the query you mentioned to similarly grab the top 10 for each query id. I don't want to get absolutely everything, because that tends to slow the whole works down.
Thanks!
Thanks for the explanation it's more clear now.
However, I am not exactly sure on how the @queries_top addition works in the change. I've tested the old/new version of sp_quickiestore and on 2019 I am seeing similar resultsets with exception of the wait stats. On 2016 the resultsets are exactly the same.
I cannot possibly troubleshoot anything with the information you've given me here.
Apologies. I've uploaded an Excel file with the result sets, including sheets with @debug=1.
Let me know if this is enough.
EDIT: url should work now
@tutuhub nothing happens when I click that link. The thing is, it works locally for me, though the results are underwhelming.
@tutuhub I'm going to close this for now. If you can troubleshoot enough on your end to provide a fix, I'll open it back up.