add index key columns and order them #25484
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 273 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.336
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #25484"
general
weight: 0.35
steveny91
What does this PR do?
Report SQL Server index key columns and included columns as separate fields on each index in the schema payload.
key_columnsis the key, in key order, withDESCon descending keys.included_columnsis only theINCLUDElist.column_namesis unchanged.Motivation
column_namesis one comma-separated string, so a reader cannot tell a key column from anINCLUDEcolumn or from a partition column SQL Server appends. A clustered key can also come back in table order instead of key order. That makes an index look like it covers a query when it does not, and it makes index recommendations get dropped because a column looks like it is already indexed.Local test
Ran this against SQL Server 2022 in
dbm/local-dev(sqlserver-primary), databaseindex_key_repro. Six rows came back.dbo.wideis columnsa, b, c, e:| defined as | key_columns | included_columns | column_names |
|---|---|---|---|
|
PRIMARY KEY CLUSTERED (b, a)|b,a| |a,b||
(c) INCLUDE (a, e)|c|a,e|c,a,e||
(c, a) INCLUDE (e)|c,a|e|c,a,e||
(c DESC, a)|c DESC,a| |c,a||
(population)on a table partitioned byid|population| |population,id||
PRIMARY KEY CLUSTERED (id)|id| |id|column_namesstill follows table order onpk_wide(a,bfor a key of(b, a)), and it is the same stringc,a,efor bothINCLUDEindexes. The new fields keep the declared key, theINCLUDElist, andDESC.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