Feature/query history v2#158
Conversation
- Update QueryStoreHistoryWindow constructor to accept query hash, metric tag, and time range parameters - Update QueryStoreHistoryWindow.axaml.cs LoadHistoryAsync to call new hash-based service method - Update QueryStoreHistoryWindow.axaml UI layout - Add average line to chart in UpdateChart method - Update QueryStoreGridControl ViewHistory_Click to pass queryHash, metric, and time range
• Generate a new query to get query history data Group data by PlanHash and IntervalStart. Get inspired by the existing FetchHistoryAsync but create a new FetchAgregateHistoryAsync. Use smart agregation for other fields • sum(field) for Totals% fields and Executions • avg(field) for Avg% fields • max(last_execution) • Allow the use to select several dots in the charts using a box selector • When the user finish the selection with the box (or a single dot selection) hightligh the corresponding rows in the query history grid • Add a thin color column in the query history grid like the legend in chart • add a small light grey border for dots • the label of avg in the chart should only have "avg:<value>". Dont insert the metric inside this label. • The avg label should have a light grey transparent background and be just above the avg horizontal line • make the avg horizontal line a little more transparent • in the chart the Y-axis should always include 0 as origin • make 2 buttons "Range Period" and "Full History" and highlight the selected and current one • remove the refresh button • align the informatial text (number of interval, number of plans...| period) to the right • remove the word metric on top of the metric selector • make the X-axis label more smart : hours first (top) and the date and "agregate date". Still use an adaptative X-axis display if the interval is large
- emphasize selected dots : bigger and white border - allow the user to select multiples rows in the grid using standard CRLT+Click or SHIFT+Click for multiselection - emphasize the dots of a manually selected rows - when the user click on a planHash in the legend : highlight all dots and the line (thicker and less transparency). also - - recompute the avg in the chart using selected/highlighted dots
erikdarlingdata
left a comment
There was a problem hiding this comment.
Hey Romain, great work on this — the QueryHash approach is the right call for historical analysis, and the chart/grid interaction is really well done. A few things I caught:
Issues
1. Duplicate using System;
QueryStoreHistoryWindow.axaml.cs has using System; twice at the top (same issue as PR #153).
2. FetchHistoryByHashAsync is dead code
The window only calls FetchAggregateHistoryAsync. FetchHistoryByHashAsync (~226 lines) is added but never referenced anywhere. Should either be removed or wired up.
3. LabelBackgroundColor alpha of 270 exceeds byte range
_avgLine.LabelBackgroundColor = ScottPlot.Color.FromHex("#333333").WithAlpha(270);Max alpha is 255. This will either clamp or overflow depending on ScottPlot's implementation.
4. OrderByToMetricTag maps "memory" to "TotalCpuMs"
Looks like a copy-paste error — should probably map to "AvgMemoryMb".
5. Display properties use N2 for integer-valued totals
TotalLogicalReadsDisplay, TotalLogicalWritesDisplay, TotalPhysicalReadsDisplay format with N2 (two decimal places). These are integer sums so N0 would be more appropriate. The averages as N2 are fine.
SQL
Looks solid — parameterized, READ UNCOMMITTED, proper weighted averaging. 👍
Overall this is a substantial and well-structured rewrite. Happy to merge once those items are addressed.
|
@erikdarlingdata : it should be OK |
What does this PR do?
Big refacto of the Query History :
Why this PR
Which component(s) does this affect?
How was this tested?
Describe the testing you've done. Include:
Checklist
dotnet build -c Debug)dotnet test)