Hi friends, as we know that in SQL Server 2012 a new feature Columnstore index was introduced which made a great change in area of performance optimization like reducing I/O. From SQL server 2012 to 2016 there were many changes made in columnstore index. In SQL Server 2012 only nonclustered columnstore index were introduced.
In the next few blogs we will discuss some limitations of columnstore index.
What is columnstore index?
From BOL: A columnstore index is a technology for storing, retrieving and managing data by using a columnar data format, called a columnstore .
Now, let’s create a test table with a SPARSE column property in it and then we will try to create a nonclustered columnstore index including that column:
CREATE TABLE Test_Sparse
FirstName VARCHAR(10) NOT NULL,
MiddleName VARCHAR(10) SPARSE,
LastName VARCHAR(10) NOT NULL
Sparse column is used to handle NULL or ZERO values as it doesn’t take any space.
Now let’s create a nonclustered columnstore index on this table using below script:
CREATE NONCLUSTERED COLUMNSTORE INDEX ix_TestSparse
ON Test_Sparse (ID, FirstName, MiddleName, LastName)
When we execute the above script it gives us error:
‘ CREATE INDEX statement failed because a columnstore index cannot be created on a sparse column. Consider creating a nonclustered columnstore index on a subset of column that does not include any sparse column.’
From the error message itself we come to know that sparse column cannot be part of columnstore index.
Drop the table –
DROP TABLE Test_Sparse
So friends, this is one of the limitation of nonclustered columnstore. We will learn some more limitations of columnstore index in my next blog.
Hope you like it J