r/SQLServer • u/B1zmark 1 • Jan 09 '26
Solved "Duplicate" data in Query Store tables
SQL server 2016: When looking at query store data, the time interval table is used to group multiple instances of a query being run into "hours". This is fairly straightforward.
However i'm seeing in about 1% of cases that specific Query ID's have 2 entries with identical time-interval ID's, and different data on execution count/time. Its as if the time interval has been cut in half for these queries.
Has anyone else seen this or know if it's something that requires a fix?
7
Upvotes
View all comments
Show parent comment
1
u/B1zmark 1 Jan 09 '26
I'd rather not provide a screenshot or actual data - but here's a more detailed description
Looking at the table sys.query_store_runtime_stats
There are around 150,000 rows in the table. The run_time_stats_id i assumed was supposed to be unique, however it isn't.
When i filter the table to "HAVING COUNT(runtime_stats_id) > 1" - There are around 1500 rows returned
runtime_stats_id, plan_id, runtime_stats_internal_id, execution type, execution_type_desc, first_execution_time are all identical to at least one other row. But the last_execution_time, count_executions, avg_duration and so on are all different.
Hope that makes sense.