In the database properties under Query Store, the "Statistics Collection Interval" is set to 1 hour. This is also confirmed by querying the view query_store_runtime_stats_interval
- all intervals span exactly 1 hour. However, when viewing reports like "Overall Resource Consumption", it is possible to select "Minute" in the dropdown for "Aggregation Size" and it shows data that looks plausible.
I was able to catch a query used in the "Top Resource Consuming Queries Report" and it looks like it displays all plans, that were also executed in the selected 1 minute interval, but the stats still seem to refer to the complete collection interval. So my guess would be to not trust anything for intervals smaller then the collection interval. Am I correct, or do the reports acutally show reliable data?
SELECT TOP (@results_row_count)
p.query_id query_id
, q.object_id object_id
, ISNULL(OBJECT_NAME(q.object_id),'') object_name
, qt.query_sql_text query_sql_text
, ROUND(CONVERT(float, SUM(rs.avg_duration*rs.count_executions))*0.001,2) total_duration
, SUM(rs.count_executions) count_executions
, COUNT(distinct p.plan_id) num_plans
FROM sys.query_store_runtime_stats rs
JOIN sys.query_store_plan p ON p.plan_id = rs.plan_id
JOIN sys.query_store_query q ON q.query_id = p.query_id
JOIN sys.query_store_query_text qt ON q.query_text_id = qt.query_text_id
WHERE NOT (rs.first_execution_time > @interval_end_time OR rs.last_execution_time < @interval_start_time)
GROUP BY p.query_id, qt.query_sql_text, q.object_id
HAVING COUNT(distinct p.plan_id) >= 1
ORDER BY total_duration DESC