Skip to content

Feature/query store waitstats#136

Closed
rferraton wants to merge 10 commits intoerikdarlingdata:mainfrom
rferraton:feature/query-store-waitstats
Closed

Feature/query store waitstats#136
rferraton wants to merge 10 commits intoerikdarlingdata:mainfrom
rferraton:feature/query-store-waitstats

Conversation

@rferraton
Copy link
Contributor

What does this PR do?

Main feature

Add informations about wait stats stored in the query store for :

  • the period selected : global
  • hour by hour for the periode selected
  • by plan with a wait profile
image

New metric

The metric Wait Time Ratio (WTR) is used but the definition vary a little bit depending on the level of detail you look at :

  • Global WTR = SUM(total_query_wait_time_ms)/(interval_selected_in_ms)
  • Hourly WTR = SUM(total_query_wait_time_ms)/(3_600_000)
  • Plan level WTR = SUM(total_query_wait_time_ms)/sum(avg_duration*exec_counts)

So this can be a little bit confusing, but i think it is a good compromise and should works well for production databases.
==> The debates are open !)
==> i have not added tooltips for that : i need to have a little reflexion on where to put the help tooltips to avoid surcharge

Features :

  • add a new column in the grid : wait profile as a stacked chart of WTR
  • sort the grid plan with the wait profile column
  • switch wait profile column display from simple stacked chart to % stacked chart in the grid
  • add a new area on the right of the RangeTime Slicer for waits stats global or hourly
  • the new area is resizable and collapsable
  • switching from global profile to hourly detail (top rigth) with a small button
  • simple click on a wait category in the global profile or in the hourly waits evolution will higligh the category is the grid for plan concerned by the wait
  • double click on a wait category in the global profile or in the hourly waits evolution will sort plan by the WTR of this wait category
  • Collasping global wait stats de-activacte the wait profile column and stop queries againsts QSabout waits
  • Tooltips on hourly bar to display wait category + date, start and end hours

Which component(s) does this affect?

  • Desktop App (PlanViewer.App)
  • Core Library (PlanViewer.Core)
  • CLI Tool (PlanViewer.Cli)
  • SSMS Extension (PlanViewer.Ssms)
  • Tests
  • Documentation

How was this tested?

2026-03-22_23h16_46

Fix compare last PR

  • search the wait profile column index position instead of using a fixed index
  • remove debug messages (keep just one in case of exception)
  • test divisor = 0 using NULLIF
  • lint some doc comments

I didn't follow suggestion about WaitRatioText and string-formatted percentages will sort lexicographically because i think (and test) and it seams the sort is correct.

Checklist

  • I have read the contributing guide
  • My code builds with zero warnings (dotnet build -c Debug)
  • All tests pass (dotnet test)
  • I have not introduced any hardcoded credentials or server names

erikdarlingdata and others added 10 commits March 19, 2026 21:21
- Increase metric label font size from 9 to 12 for readability
- Use ForegroundBrush instead of muted SlicerLabelBrush for metric label
- Fix metric label showing "Total" for avg metrics (e.g., avg-cpu showed
  "Total CPU" instead of "Avg CPU") by splitting combined or-patterns
- Add per-bucket average properties to QueryStoreTimeSlice so the slicer
  chart shape reflects the selected metric (total vs avg) instead of
  always showing totals

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…r-metric-label

Fix Query Store time slicer metric display
…ait profile with v/% toggle, resizable separator with chevron, ribbon click/double-click interactions
- display simple stacked wait profile per default instead on %stacked
Most Debug.WriteLine statements for wait stats have been removed, leaving only exception logging. The WaitProfile column visibility toggle now uses SortMemberPath instead of a hardcoded index, making the code more robust to column order changes.
Wrapped denominator in NULLIF to avoid division by zero errors
when calculating wait_ratio in QueryStoreService.cs.

Also made
minor formatting and comment improvements for clarity.
@rferraton rferraton closed this Mar 23, 2026
@rferraton
Copy link
Contributor Author

Sorry i was distracted and push to main instead dev

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.

2 participants