Skip to content

WPF FinOps latest-database-sizes read plans for 148 ms over every database_size_stats chunk to execute in 2.6 ms #4245

Description

@erikdarlingdata

Problem

DatabaseSizeLatestSql, the WPF viewer's FinOps "latest database sizes" read, spends almost all of its time planning. It has no collection_time bound, so the planner considers every retained database_size_stats chunk to find the newest snapshot.

Measured

From #4227's field comment: a production SQL Server store, 2026-09-25, the busiest server, read-only EXPLAIN (ANALYZE, BUFFERS). The read took 2.6 ms to execute and 148 ms to plan, with 80 buffers, over 71 database_size_stats chunks.

Until #4240, FinOps refreshed every 30 s, so this ran twice a minute per open tab. #4240 moves the tab to a refresh on activation, which cuts how often it runs. Each activation still pays the planning cost, and that cost grows with retention and with the chunk count.

Fix shape

  • Bound the read by collection_time so the planner can exclude old chunks, without changing the result. The newest snapshot must still come back for a server whose collection stopped days ago. One option: probe each server's newest collection_time first (a one-chunk read), then read that snapshot with the bound.
  • Measure planning before and after on a seeded store with 30+ days of chunks.
  • Check Lite: DuckDB has no chunks, so this is likely Darling only. Say so with the reason.

Related

Activity

  1. added
    enhancementNew feature or request
    client-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)
    on Sep 25, 2026
  2. erikdarlingdata commented on Sep 25, 2026

    @erikdarlingdata
    OwnerAuthor

    Closed by the watcher: delivered in PR #4252, merged to dev.

  3. removed
    in-progressActively being worked by a local session or its agents (PR open or in flight)
    on Sep 25, 2026
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

    client-siteOwned by the client-site agents (other laptop). Local sessions never pick these up.enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions