Fix/querystore grid performance#146
Conversation
… plan grid and try improve performance of querystore grid fetch
erikdarlingdata
left a comment
There was a problem hiding this comment.
Code Review
Thanks for the work here, @rferraton — there are several genuinely good improvements in this PR. However, the query changes in QueryStoreService.cs conflict with PR #145 (already merged to dev), which rewrote the main grid query using sp_QuickieStore patterns. Merging this as-is would regress that work.
Query changes — conflicts with #145
PR #145 already shipped a 4-phase materialized temp table approach:
#intervalswith clustered PK + EXISTS semi-join for time filtering#plan_statswith clustered PK for plan-level aggregationOPTION(RECOMPILE)on aggregation phases to prevent parameter sniffingTRY_CONVERTfor safe plan XML handling- Single join to text/plan tables for the final TOP N winners
This PR's query changes would overwrite all of that with:
- CTE-based
plan_agg(not materialized, no clustered PK) - No interval pre-filtering temp table
- No RECOMPILE hints
- Double-joins to
query/query_text/plan— once into#top_plansfor filters, again in the final SELECT for text/plan - LEFT OUTER JOINs that aren't needed (Query Store has referential integrity, and the optimizer eliminates unused INNER JOINs)
- Final SELECT is missing ORDER BY — results won't be in expected sort order
Good parts we'd like to keep
These improvements are valuable and should be applied on top of current dev:
1. Wait stats split into global vs per-plan — FetchGlobalWaitStatsOnlyAsync + FetchPerPlanWaitStatsAsync is smart architecture. Starting global wait stats early (before the grid query completes) is a genuine parallelization win.
2. Plan ID temp table for per-plan wait stats — passing visible plan IDs via #plan_ids so we only fetch wait stats for the TOP N plans is a good optimization.
3. Progress bars — grid loading overlay and wait stats loading indicator are nice UX additions.
4. Handle hit zones — transparent rectangles at left/right slicer handles to fix pointer event interception.
Suggested path forward
Could you rebase onto current dev (which has #145's query) and drop the QueryStoreService.cs query rewrite? Keep the wait stats split, plan ID filtering, progress bars, and handle hit zones. That way we get all your UI improvements without regressing the query performance work.
Alternatively, we can extract the good parts on our side if that's easier for you. Let us know which you'd prefer!
What does this PR do?
Try to improve performance of QS grid query
add 2 progress bars for waits stats gloabl and grid
fix some issue with timerange selector handles
Which component(s) does this affect?
How was this tested?
Remarks
I found the queries slower than on SSMS. should check the config. Fetch size maybe ?
Describe the testing you've done. Include:
Checklist
dotnet build -c Debug)dotnet test)