Add object name filters for SQL Server index usage and table size metrics - #24951
Merged
Conversation
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🔗 Commit SHA: b65c6e2 | Docs | View more details | Give us feedback! |
evalya-impact-summaryevalya impact analysis |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef82d3c9d8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
jasonmp85
force-pushed
the
jmp/sqlserver-2a-object-bounds
branch
3 times, most recently
from
August 25, 2026 15:47
a98689d to
9e62ba0
Compare
jasonmp85
force-pushed
the
jmp/sqlserver-2a-object-bounds
branch
from
August 25, 2026 19:16
5962c11 to
60d008b
Compare
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jasonmp85
force-pushed
the
jmp/sqlserver-2a-object-bounds
branch
from
August 25, 2026 19:31
267cd8b to
b65c6e2
Compare
Contributor
Validation ReportAll 21 validations passed. Show details
|
lu-zhengda
approved these changes
Aug 25, 2026
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.
What does this PR do?
Adds two optional configuration options that bound the table sets scanned by the two highest-fan-out database metric collectors:
index_usage_table_names, applied toindex_usage_metricstable_size_table_names, applied totable_size_metricsWhen unset, behavior is unchanged. When set, the collector filters to the named tables. For index usage, these are table names—not index names—and metrics are collected for every index belonging to each matching table. This mirrors the existing
db_fragmentation_object_namesoption, which provides the same escape hatch for the third high-fan-out collector; that legacy option also accepts table names despite its broader name. Postgres offers the equivalent lever asrelations, whose own documentation warns that "patterns that match many relations can emit metrics in the thousands."Measured effect
Sample volume scales with schema size, which is the fan-out being bounded (15-database pool):
Bounding on the 300-table pool (15 databases x 301 tables):
table.row_countfragment_countAnd on a partitioned pool (5 databases x 10 tables, 1,200 index partitions), confirming the filter reaches partitioned indexes:
table.row_countfragment_countSample counts land exactly where the configuration predicts — 45 = 15 databases x 3 tables, 15 = 5 x 3, and fragmentation falls to 3/10 of unbounded on the partitioned pool. A 3-name bound cuts the wide pool by 89x.
Motivation
These collectors emit four samples per index and four per table respectively, giving a floor of roughly 28 samples per table before partitioning is taken into account. On instances with large schemas this produces both very large sample volumes and very large result sets, and row volume is the dominant cost: a separate experiment showed the check's
dm_os_performance_countersquery inflating 18.79x across 16 threads but only 2.25x across 16 processes with the server held constant, which places the serialization in CPython's GIL while pyodbc materializes rows rather than in SQL Server.The failure this addresses is also directly reproducible. On a bench instance with 3,586 autodiscovered databases, an unmodified check produces:
Bounding the table set is the only lever that reduces row volume without disabling the collector outright. Today a user can reach for that lever on fragmentation metrics but not on the other two, which is the inconsistency this closes.
Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged