Skip to content

At "Last 7 days" the WPF Queries grids silently show ~4 days: Top Queries, Top Procedures and Query Store read raw tables dropped at 4 days, with no floor disclosure (get_query_store_top got one in #2364; the viewer and the query-stats MCP tools didn't) #4231

Description

@erikdarlingdata

Problem

The WPF server tab's toolbar offers "Last 7 days". Three Queries sub-tabs read only raw tables, and all three are dropped at 4 days on a store with the rollups armed:

grid table
Top Queries by Duration query_stats
Top Procedures by Duration procedure_stats
Query Store by Duration, and its slicer query_store_stats

None of these reads routes to a rollup, and none reports how far back it actually reached. At 7 days the grid ranks about 4.2 days of work under a header and toolbar that say 7, and nothing on screen says so.

#2364 fixed exactly this for MCP get_query_store_top: it reads the window floor and returns effective_start / window_truncated. The WPF Query Store grid, the WPF Top Queries and Top Procedures grids, and MCP get_top_queries_by_cpu / get_top_procedures_by_cpu never got the same treatment. The WPF viewer's own Performance Trends tab does disclose (QueryTrendSeries.Truncated, rendered in the plot title), so one tab of one screen is honest and the grid beside it isn't.

It's also the expensive way to be wrong: the 7-day read scans and dedupes all 4 days of raw.

Measured

2026-09-25, read-only:

  • Raw floors. Production SQL Server store B: query_stats and procedure_stats both start at 2026-09-21 00:00, 4.19 days back at 04:32Z. Store A (live Query Store), one busy server: query_store_stats starts at 2026-09-21 00:02, 918,803 rows in the "7-day" window.
  • The WPF Query Store grid's read (QueryStoreTopSql) at 7 days, same server: 4,078 ms, 162.9 k buffers (28 k read). The window sort spilled: external merge of 100 + 121 + 203 MB, 53 k temp blocks written, at that store's current work_mem. At 24 h the same read is 1,090 ms with no spill.

Where (origin/dev)

  • Darling/PerformanceMonitor.Darling.Viewer/ViewerServerTab.Queries.cs: LoadTopQueriesAsync ~:172, LoadTopProceduresAsync ~:181, LoadQueryStoreAsync ~:190. None reads a floor or renders one.
  • Darling/PerformanceMonitor.Darling.Viewer/ViewerDataService.QueryStats.cs TopQueriesSql ~:149, ViewerDataService.ProcedureStats.cs TopProceduresSql ~:88, ViewerDataService.QueryStore.cs QueryStoreTopSql ~:123 and QueryStoreSlicerSql ~:595.
  • The disclosure that exists: Darling/PerformanceMonitor.Darling.Service/Mcp/DarlingMcpDataTools.cs get_query_store_top ~:796–880, and DarlingDataReader.QueryStoreWindowFloorSql ~:1323 (a bounded MIN(collection_time), a one-chunk probe).
  • The tools without it: DarlingMcpDataTools.cs get_top_queries_by_cpu ~:515/:560 and get_top_procedures_by_cpu ~:671/:690, both over raw DarlingDataReader.TopQueriesSql / procedure reads.

Fix shape

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclient-siteOwned by the client-site agents (other laptop). Local sessions never pick these up.in-progressActively being worked by a local session or its agents (PR open or in flight)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions