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

  1. added
    bugSomething isn't working
    client-siteOwned by the client-site agents (other laptop). Local sessions never pick these up.
    on Sep 25, 2026
  2. erikdarlingdata commented on Sep 25, 2026

    @erikdarlingdata
    OwnerAuthor

    Ruled: how this gets built

    Three pieces, in this order:

    1. Darling disclosure (now). One shared floor helper for query_stats, procedure_stats and query_store_stats, built from get_query_store_top reports a window it cannot serve: raw query_store_stats is dropped at 4 days #2364's QueryStoreWindowFloorSql. It must stay a one-chunk probe. The PR says "Part of 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".
      • get_top_queries_by_cpu and get_top_procedures_by_cpu add effective_start, effective_hours_back and window_truncated, with the same names and meaning as get_query_store_top. Existing fields and defaults stay as they are.
      • The WPF Top Queries, Top Procedures and Query Store grids show "Showing since " in the header when the window is cut short. The web viewer's pages for the same tools show the same note.
      • The threshold is get_query_store_top reports a window it cannot serve: raw query_store_stats is dropped at 4 days #2364's 90-minute slack, reusing its constant.
    2. Lite disclosure (next). Lite keeps 30 days of raw query data by default. A user can lower that, and a new install has less history, so the same silent cut can happen there. Same rules, Lite's own grids and tools.
    3. Routing the top-N reads to the hourly rollups (after Legacy trio off the refresh grid (#3653) #4186 merges). This builds on RollupCoverage, and Legacy trio off the refresh grid (#3653) #4186 changes it. The disclosure ships first either way, and it is still needed for query_store_stats, which has no rollup that keeps query_id.

    \U0001F916 Generated with Claude Code

    https://claude.ai/code/session_01TszxYhJJbTEh4LrZ56NYo3

  3. added
    in-progressActively being worked by a local session or its agents (PR open or in flight)
    on Sep 25, 2026
  4. erikdarlingdata commented on Sep 25, 2026

    @erikdarlingdata
    OwnerAuthor

    Status: #4278 (the Darling half) merged to dev (f0370dc). Left: #4279 (the Lite half, next; its last step updates the shared tool descriptions in both products), and stage 3 (routing the top-N reads to the hourly rollups) after #4186.

  5. erikdarlingdata commented on Sep 25, 2026

    @erikdarlingdata
    OwnerAuthor

    Status: #4279 (the Lite half) merged to dev (2febee9). It also made the three tools' short descriptions the same on Lite and Darling, which was the last step #4278 left. Left: stage 3, routing the top-N reads to the hourly rollups, after #4186.

  6. added 5 commits that reference this issue on Sep 26, 2026
  7. erikdarlingdata commented on Sep 26, 2026

    @erikdarlingdata
    OwnerAuthor

    Claude posting for Erik Darling.

    #4396 is merged (3076048), stage 3a. get_top_queries_by_cpu (MCP, the Storage reader and the Viewer) now reads the hourly rollup once raw retention has dropped the window, and reports tier_used and precision_note.

  8. erikdarlingdata commented on Sep 26, 2026

    @erikdarlingdata
    OwnerAuthor

    Claude posting for Erik Darling.

    #4413 is merged, stage 3b. get_top_procedures_by_cpu and the Viewer's Top Procedures grid now read the hourly rollup once raw retention has dropped the window, and report tier_used and precision_note.

  9. erikdarlingdata commented on Sep 26, 2026

    @erikdarlingdata
    OwnerAuthor

    Claude posting for Erik Darling.

    Closing: all three pieces of the build plan are on dev.

    1. Darling disclosure: MCP top-queries/top-procedures disclose a shortened raw-tier window (#4231) #4278. get_top_queries_by_cpu and get_top_procedures_by_cpu report effective_start / effective_hours_back / window_truncated, and the WPF Top Queries, Top Procedures and Query Store grids show "Showing since …" when the window is cut short.
    2. Lite disclosure: Lite MCP tools disclose a truncated query-stats window (#4231) #4279.
    3. Routing to the hourly rollups: Top-N-by-CPU routes to the hourly rollup once raw's floor ages past the window (#4231) #4396 (top queries) and Route get_top_procedures_by_cpu and the Top Procedures grid to the hourly rollup (#4231) #4413 (top procedures). Once raw retention has dropped part of the window, both read the hourly rollup, and they report tier_used and precision_note.

    query_store_stats keeps the disclosure only, because no rollup carries query_id. That was in the plan from the start.

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