Columnstore Index in SQL Server

Columnstore Index in SQL Server

Column store indexes column segment based data storage for each column thereby reducing the cost of storage since it compresses the size up to 10 times than a normal row store database.

We can use columnstore index for Data warehouse and OLAP workloads, as it has very high query performance if we maintain very less row groups.

A rowgroup is a group of rows that are compressed into columnstore format at the same time. A rowgroup usually contains the maximum number of rows per rowgroup, which is 1,048,576 rows.

For high performance and high compression rates, the columnstore index slices the table into rowgroups, and then compresses each rowgroup in a column-wise manner. The number of rows in the rowgroup must be large enough to improve compression rates, and small enough to benefit from in-memory operations.

A column segment is a column of data from within the rowgroup.

  • Each rowgroup contains one column segment for every column in the table.
  • Each column segment is compressed together and stored on physical media.

During a large bulk load, most of the rows go directly to the columnstore without passing through the deltastore. Some rows at the end of the bulk load might be too few in number to meet the minimum size of a rowgroup, which is 102,400 rows. As a result, the final rows go to the deltastore instead of the columnstore. For small bulk loads with less than 102,400 rows, all of the rows go directly to the deltastore.

No alt text provided for this image
  • Does not pre-sort the data. Data is inserted into rowgroups in the order it is received.
  • If the batch size is >= 102400, the rows are directly into the compressed rowgroups. It is recommended that you choose a batch size >=102400 for efficient bulk import because you can avoid moving data rows to a delta rowgroups before the rows are eventually moved to compressed rowgroups by a background thread, Tuple mover (TM).
  • If the batch size < 102,400 or if the remaining rows are < 102,400, the rows are loaded into delta rowgroups.

To create a columnstore index

CREATE COLUMNSTORE INDEX idx_cs1 ON EmployeeTable (FirstName, LastName, HireDate, Gender)


要查看或添加评论,请登录

Sujith T的更多文章

  • How does the Microsoft tablediff utility work?

    How does the Microsoft tablediff utility work?

    It's a hectic task for DBA’s to fix the mismatched data in the SQL Server replicated tables. The records in the…

    1 条评论
  • Overview on SQL Server Database Snapshots

    Overview on SQL Server Database Snapshots

    Database snapshot is a read only static collection of a source database.Multiple snapshot can be created for a single…

  • Cassandra Backup and Restoration

    Cassandra Backup and Restoration

    Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data…

社区洞察

其他会员也浏览了