ram
ram

Reputation: 343

Can we create clustered index with include columns

Can we create a clustered index with include columns in Microsoft SQL Server (T-SQL)?

If yes then how does it work internally?

As per my understanding the leaf level of the clustered index are the actual data pages itself, and it stores entire row include with the key column (on which index is created).

Upvotes: 10

Views: 9201

Answers (1)

e_i_pi
e_i_pi

Reputation: 4820

You cannot specify included columns in a clustered columnstore index. From the manual:

Nonkey columns can only be defined on nonclustered indexes

The reason for this is that when you apply a clustered columnstore index to a table, SQL Server changes the physical storage of the table to columns. As such, all columns are included in the clustered columnstore index.

Upvotes: 8

Related Questions