Skip to content

fix: don't aggregate columns for clustered columnstore indexes in describe_indexes#745

Open
Benjamin-Knight wants to merge 1 commit into
dbt-msft:masterfrom
Benjamin-Knight:fix/cci-skip-column-comparison
Open

fix: don't aggregate columns for clustered columnstore indexes in describe_indexes#745
Benjamin-Knight wants to merge 1 commit into
dbt-msft:masterfrom
Benjamin-Knight:fix/cci-skip-column-comparison

Conversation

@Benjamin-Knight

@Benjamin-Knight Benjamin-Knight commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

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.

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

describe_indexes aggregates every table column for clustered columnstore indexes (needless work + root of #735 overflow)

1 participant