Skip to content

Lazy-load server tabs and cap query grid results to TOP 500#852

Merged
erikdarlingdata merged 2 commits intodevfrom
fix/lazy-load-server-tabs
Apr 16, 2026
Merged

Lazy-load server tabs and cap query grid results to TOP 500#852
erikdarlingdata merged 2 commits intodevfrom
fix/lazy-load-server-tabs

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

  • Lazy-load tabs: Opening a server tab now only loads the visible tab (Overview). Other tabs load on first switch. This prevents heavy queries like GetQueryStatsAsync from running when the user just wants Overview.
  • First-visit full load: First switch to any tab does a full refresh (all sub-tabs). Subsequent auto-refreshes only hit the active sub-tab.
  • Ctrl+Click / Ctrl+F5: Refreshes all tabs at once for users who want the old behavior. Tooltip on Refresh Tab button documents this.
  • TOP 500 cap: GetQueryStatsAsync, GetProcedureStatsAsync, and GetQueryStoreDataAsync now return at most 500 rows (ordered by avg CPU desc). Prevents unbounded memory consumption on large installations.

Fixes #835 — tested against a report from a user with 49 databases and 742K rows in query_stats after 3 days, where the queries were timing out after 120 seconds and consuming 4GB+ memory.

Test plan

  • Both commits build with 0 warnings, 0 errors
  • Opening a server tab loads fast (Overview only)
  • Switching to Queries tab loads all sub-tabs on first visit
  • Subsequent Refresh Tab only refreshes visible tab
  • Ctrl+Click on Refresh Tab refreshes all tabs
  • Apply to All Tabs still does full refresh
  • Verify TOP 500 doesn't truncate meaningful data for typical installations

🤖 Generated with Claude Code

erikdarlingdata and others added 2 commits April 16, 2026 07:22
…rst visit

Initial tab open and Refresh button now only load the currently visible tab.
First switch to any tab triggers a full refresh of that tab (all sub-tabs).
Subsequent refreshes only hit the active sub-tab.

Ctrl+Click on Refresh Tab (or Ctrl+F5) refreshes all tabs at once.
Apply to All Tabs retains existing full-refresh behavior.

Fixes #835 — prevents heavy queries (e.g. GetQueryStatsAsync) from running
on tab open when the user is only viewing Overview.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GetQueryStatsAsync, GetProcedureStatsAsync, and GetQueryStoreDataAsync
were returning unbounded result sets. With 49 databases and 742K rows
in query_stats over 3 days, the GROUP BY with plan XML could produce
thousands of rows and timeout after 120 seconds.

TOP 500 ordered by avg CPU desc is plenty for a grid view and prevents
the query from consuming unbounded memory on large installations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit a88572c into dev Apr 16, 2026
3 checks passed
@erikdarlingdata erikdarlingdata deleted the fix/lazy-load-server-tabs branch April 19, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant