fix: don't aggregate columns for clustered columnstore indexes in describe_indexes#745
Open
Benjamin-Knight wants to merge 1 commit into
Open
Conversation
…cribe_indexes
A clustered columnstore index (type 5) stores the whole table and has no key
columns, so sys.index_columns lists every column for it. describe_indexes was
aggregating all of them into the `columns` field, which:
- is meaningless: reconciliation (index_config_changes) matches a CCI by
name and type only and never compares its columns, and
- was the underlying cause of the STRING_AGG 8000-byte overflow in dbt-msft#735 —
the nvarchar(max) cast merged there stops the *error* but still builds a
~25 KB column list on every reconcile of a wide table.
Guard the key-column aggregation with `i.[type] <> 5` so a CCI reports no
columns. The nvarchar(max) cast is kept as defense for wide *nonclustered*
columnstore indexes (type 6), whose columns are genuine user-chosen identity.
Extends the wide-columnstore functional test to assert describe_indexes
reports no columns for the CCI.
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Follow-up to #735. Resolve #744
A clustered columnstore index (type 5) stores the whole table and has no key columns, so sys.index_columns lists every column for it. sqlserver__describe_indexes was aggregating all of them into the columns field, which is (a) meaningless — reconciliation matches a CCI by name/type and never compares its columns — and (b) the underlying cause of the STRING_AGG 8000-byte overflow.
Change: guard the key-column aggregation with i.[type] <> 5 so a CCI reports no columns. The nvarchar(max) cast is kept as defense for wide nonclustered columnstore indexes (type 6), whose columns are genuine user-chosen identity.
Testing: extends the existing wide-columnstore functional test with a run-operation that calls describe_indexes and asserts the CCI is described with zero columns. Existing reconcile-survival assertion unchanged. All 281 unit tests pass.
Scope is deliberately narrow: only type 5 is affected; types 1/2/6 are untouched.