Add Query Store server-side filter panel, chips, and pre-filters#392
Merged
Conversation
Core: - QueryStoreFilter: MinExecutions, MinDurationMs, MinCpuMs (window-wide per-plan averages), QueryTextSearchNot, EscapeBrackets, and four include/ignore query-id/plan-id lists; strict ParseIdList (ordered dedupe, throws on garbage); BuildQueryTextSearchPattern escapeBrackets overload (escapes [ ] _ for ESCAPE '\', % stays live) - All three SQL builders (flat, grouped-by-hash, grouped-by-module) gain the new clauses pre-TOP-N, fully parameterized; rn=1 relaxed when plans are explicitly included; unset path renders byte-identical SQL - QueryStoreServerFilterState: UI-free, unit-testable filter model (typed setters, ordered chips, 1:1 BuildFilter projection) Desktop: - Collapsible Server Filters panel (thresholds, text include/exclude, escape toggle, id lists) with transactional Apply - Chip strip showing every criterion that shaped the fetch; chips are removable and re-fetch - Column-filter popups gain 'Search server' promotion on mapped columns (Executions/AvgCpu/AvgDuration/ids/hashes/text) with operator validation at click; totals deliberately not promotable - Search-by commits become chips; Clear clears all server filters; panel expanded state persisted MCP/CLI: - Nine additive get_query_store_top params and query-store options Tests: 59 new (escape-mode matrix, ParseIdList contract, filter-state model) - 182 total passing Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sp_QuickieStore-style pre-filters that apply before TOP N in all three SQL builders, so target queries are found even when they aren't in the top N by the chosen metric.[ ] _matching (EF-style bracketed text), and include/ignore lists for query IDs and plan IDs.Closes #391
Changes
QueryStorePlan.cs): nine newQueryStoreFilterproperties;ParseIdList(strict: ordered first-seen dedupe, throws naming any bad token);BuildQueryTextSearchPatterngains anescapeBracketsoverload (wrap-then-escape,%never escaped, pairs withESCAPE '\').QueryStoreService.cs,QueryStoreService.Grouped.cs): all criteria added to the pre-TOP-N filter mechanism in the flat and both grouped builders, fully parameterized (per-elementIN/NOT INparams); thresholds use null-safe> 0guards and a float-literal multiplication form that avoids a numeric-precision overflow edge;rn = 1is relaxed when plans are explicitly included so a non-best plan isn't dropped; with everything unset the generated SQL is byte-identical to before.QueryStoreServerFilterState.cs, Core — unit-testable): typed normalizing setters, ordered chip projection, 1:1BuildFilter();EscapeBracketsis a pure modifier (no chip, ignored byIsEmpty, always copied).QueryStoreGridControl.*,ColumnFilterPopup.*,AppSettingsService.cs): panel + chips rows; Search-by commits now flow into the shared filter state as chips;Fetch_Clickcommits before fetching; Clear clears all server filters and re-fetches; promotion maps Executions/AvgCpu/AvgDuration (measure-preserving; totals deliberately excluded), ids/hashes (Equals), text/module (Contains) with operator validation at click; panel expanded state persisted.McpQueryStoreTools.cs): nine additiveget_query_store_topparams. CLI (QueryStoreCommand.cs): nine additive options. Malformed id lists error cleanly on both surfaces before any connection attempt.ParseIdListcontract, and the filter-state model (chips, normalization, mapping, coexistence).Test Plan
dotnet build PlanViewer.sln -c Debug— no new warningsdotnet test— 182/182 (123 existing + 59 new)--escape-bracketsflips[Users]between literal and character-class matching; text include+exclude compose correctly (empty results ground-truthed against raw Query Store DMVs); stacked filters AND together--helpshows all nine options; malformed--include-query-ids "1,x,3"exits 1 with a clear message before connectingGenerated with Claude Code