Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Module 7

Columnstore Indexes
Module Overview

Introduction to Columnstore Indexes


Creating Columnstore Indexes
• Working with Columnstore Indexes
Lesson 1: Introduction to Columnstore Indexes

What are Columnstore Indexes?


Nonclustered Columnstore Indexes
Clustered Columnstore Indexes
• Demonstration: The Benefits of Using
Columnstore Indexes
What are Columnstore Indexes?
Nonclustered Columnstore Indexes

• Nonclustered Columnstore Indexes


• Contains some or all columns
• Used in combination with rowstore tables
• Updatable
• Can be filtered
• Uses more space than just a rowstore
Clustered Columnstore Indexes

• Clustered columnstore indexes


• Must contain all columns
• Optimize data for storage and performance
• Row based indexes can be added
• Cannot be filtered
Demonstration: The Benefits of Using
Columnstore Indexes

• In this demonstration, you will see how to create


a columnstore index
Lesson 2: Creating Columnstore Indexes

Creating a Nonclustered Columnstore Index


Creating a Clustered Columnstore Index
Creating a Clustered Columnstore Table with
Primary and Foreign Keys
• Demonstration: Creating Columnstore Indexes
Using SQL Server Management Studio
Creating a Nonclustered Columnstore Index

• Create columnstore indexes using Transact-SQL


• CREATE NONCLUSTERED COLUMNSTORE INDEX

• Create columnstore indexes using SSMS


• Databases
• AdventureWorksDW
• Tables
• FactFinance
• Right-click Indexes
• New index
• Nonclustered Columnstore Index
Creating a Clustered Columnstore Index

• Create a clustered columnstore index


• CREATE CLUSTERED COLUMNSTORE INDEX
• SSMS
• New Index
• Clustered Columnstore Index
Creating a Clustered Columnstore Table with
Primary and Foreign Keys
Demonstration: Creating Columnstore Indexes
Using SQL Server Management Studio

In this demonstration, you will see how to:


• Create a nonclustered columnstore index using
SSMS
• Create a clustered columnstore index using SSMS
Lesson 3: Working with Columnstore Indexes

Managing Columnstore Indexes


Index Fragmentation
• Columnstore Indexes and Memory Optimized
Tables
Managing Columnstore Indexes
Index Fragmentation

• Use sys.dm db index_physical stats to determine


index fragmentation
• Reorganize
• Fragmentation between 5% and 30%
• Rebuild
• Fragmentation greater than 30%
Columnstore Indexes and Memory Optimized
Tables

In-memory columnstore tables


• The index has to be declared at runtime
• Tables can be up to 2 TB in size
• Can be combined with rowstore index
• Enable real-time operational analytics

Memory Optimization Advisor can be used to


support moving a table from being disk based to
being memory-optimized.
Lab: Using Columnstore Indexes

Exercise 1: Create a Columnstore Index on the


FactProductInventory Table
Exercise 2: Create a Columnstore Index on the
FactInternetSales Table
• Exercise 3: Create a Memory Optimized
Columnstore Table
Logon Information
Virtual machine: 20762C-MIA-SQL
User name: ADVENTUREWORKS\Student
Password: Pa55w.rd

Estimated Time: 45 minutes


Lab Scenario

Adventure Works has created a data warehouse


for analytics processing of its current online sales
business. Due to large business growth, existing
analytical queries are no longer performing as
required. Disk space is also becoming more of an
issue.
 
You have been tasked with optimizing the existing
database workloads and, if possible, reducing the
amount of disk space being used by the data
warehouse.
Lab Review

• Why do you think the disk space savings were so


large for the disk based clustered columnstore
index?
Module Review and Takeaways

• Best Practice

You might also like