Clustered columnstore indexes
In the last sections of this chapter, you will learn how to manage a CCI. Besides optimizing query performance, you will also learn how to add a regular B-tree nonclustered index (NCI) to a CCI and use it instead of the primary key or unique constraints. When creating the NCCI in the previous sections, we didn't use LZ77 or archive compression. You will use it with a CCI in this section. Altogether, you will learn how to do the following:
- Create clustered columnstore indexes
- Use archive compression
- Add B-tree NCI to a CCI
- Use B-tree NCI for a constraint
- Update data in a CCI
Compression and query performance
Let's start by dropping both indexes from the demo fact table, the NCCI and the CI, to make a heap again:
USE WideWorldImportersDW; -- Drop the NCCI DROP INDEX NCCI_FactTest ON dbo.FactTest; -- Drop the CI DROP INDEX CL_FactTest_DateKey ON dbo.FactTest; GO
Now let's create the CCI:
CREATE CLUSTERED COLUMNSTORE INDEX CCI_FactTest ON dbo.FactTest; GO...