From eda7c81ba2e1b72704a716d899dcefffb80a9c8d Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Thu, 19 Feb 2026 18:36:44 -0500 Subject: [PATCH] Add 7-day time filter to drill-down queries (#165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All three drill-down windows (Query Store, Query Stats, Procedure Stats) fetched ALL historical data with no time limit — up to 3776 rows per query, each carrying ~10KB of plan XML. Added 7-day time filter to collection_time on all three queries to keep result sets manageable. Co-Authored-By: Claude Opus 4.6 --- Dashboard/Services/DatabaseService.QueryPerformance.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dashboard/Services/DatabaseService.QueryPerformance.cs b/Dashboard/Services/DatabaseService.QueryPerformance.cs index 1d930bbd..65da006f 100644 --- a/Dashboard/Services/DatabaseService.QueryPerformance.cs +++ b/Dashboard/Services/DatabaseService.QueryPerformance.cs @@ -1486,6 +1486,7 @@ public async Task> GetQueryStoreHistoryAsync(str FROM collect.query_store_data AS qsd WHERE qsd.database_name = @database_name AND qsd.query_id = @query_id + AND qsd.collection_time >= DATEADD(DAY, -7, SYSDATETIME()) ORDER BY qsd.collection_time DESC;"; @@ -1591,6 +1592,7 @@ public async Task> GetProcedureStatsHistoryA FROM collect.procedure_stats AS ps WHERE ps.database_name = @database_name AND ps.object_id = @object_id + AND ps.collection_time >= DATEADD(DAY, -7, SYSDATETIME()) ORDER BY ps.collection_time DESC;"; @@ -1704,6 +1706,7 @@ public async Task> GetQueryStatsHistoryAsync(string FROM collect.query_stats AS qs WHERE qs.database_name = @database_name AND qs.query_hash = CONVERT(binary(8), @query_hash, 1) + AND qs.collection_time >= DATEADD(DAY, -7, SYSDATETIME()) ORDER BY qs.collection_time DESC;";