Upload
jason-strate
View
805
Download
2
Tags:
Embed Size (px)
DESCRIPTION
Columnstore indexes were first introduced in SQL Server 2012. Columnstore indexes provide the ability to flip-over your indexes from column-based to row-based, leading to dramatic changes in the storage and performance of your data. In this session, we'll review the basic concepts of columnstore indexes and look at the changes coming to them in SQL Server 2014
Citation preview
Introduction to Columnstore Indexes
Jason Strate
b: www.jasonstrate.com
t: StrateSQL
Resources jasonstrate.com/go/indexing
Introduction
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
• Industry leaders in Microsoft BI and SQL Server Platform
• SQL Server Professionals - PASS Board of Directors, Speakers, Authors and MVP’s
• National Sales Team Divided by Microsoft Territories
• National System Integrator (NSI)• Gold Certified in Business Intelligence and Data
Platform• Platform Modernization/Safe Passage• Premier Partner for PDW SI Partner Program
MS PDW Partner of Year FY13Frontline Partnership Partner of the Year for Big DataExecutive sponsor - Andy Mouacdie, WW sales director PDW
• Over 7,200 customers worldwide• Over 186,000 people in PW database for demand
generation
About Pragmatic Works
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Everyone wants fast queries
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Sometimes Normal Doesn’t Make Sense
We need to change what we do
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
To get things back to normal
Agenda
Introduction Columnstore BasicsSQL Server
Columnstore
Non-Clustered Columnstore
Clustered Columnstore
Summary
Agenda
Introduction Columnstore BasicsSQL Server
Columnstore
Non-Clustered Columnstore
Clustered Columnstore
Summary
Session Goals
• Identify differences between rowstore and columnstore indexes
• Describe implementation of columnstore index in SQL Server
• Define pros and cons with columnstore indexes
• Demonstrate use of columnstore indexes
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Agenda
Introduction Columnstore BasicsSQL Server
Columnstore
Non-Clustered Columnstore
Clustered Columnstore
Summary
Index Problems
• Indexes traditionally are row-based
– All columns for row stored together
• Any column read brings over all columns
– Impacts IO, CPU, and memory
– Typically 15% of DW columns in queries
• Databases growing 10x every 5 years
• Tuning for over indexing, under indexing, and bookmark lookups
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Columnstore Basics
• Change data storage from row to column based
– Rowstores
– Columnstores
• Data grouped by columns
– One column per grouping (segment)
– Data access at columns level
– Only return columns required for query
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Say What?!
Traditional Index
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Columnstore Index
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Columnstore Index
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Why Columnstore?
• Improved query performance
– Column centric reads
– Heavy data compression
– Processing by batch versus row
• Improved resource utilization
– Smaller index space
– Less memory required
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Agenda
Introduction Columnstore BasicsSQL Server
Columnstore
Non-Clustered Columnstore
Clustered Columnstore
Summary
SQL Server Columnstore
• Introduced to improve data warehouse performance
• Available since SQL Server 2012
• SQL Server 2012
– Non-clustered columnstore
• SQL Server 2014
– Clustered columnstore
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Columnstore Attributes
• Introduced in SQL Server 2012• Supports batch mode processing• SQL Server 2012
– Non-clustered columnstore– No key columns– Support partitioning– Read only index
• SQL Server 2014– Clustered columnstore– Columnstore archive format– Read\write when clustered
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Batch-mode Processing
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
1 record versus 415 records
Columnstore Restrictions
• Cannot be a unique index.• Cannot be created on a view or
indexed view.• Cannot include a sparse
column.• Cannot act as a primary key or
a foreign key.• Cannot be created with
the INCLUDE keyword• Cannot include
the ASC or DESC keywords for sorting the index
• No seek operations
• Cannot contain a column with a FILESTREAM attribute
• Limited data types– Except varchar(max),
nvarchar(max), binary, varbinary, ntext, text, image, uniqueidentifier, rowversion, timestamp, sqlvariant, xml, CLR types
• Feature restrictions– Replication– Change tracking– Change data capture– Filestream
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Agenda
Introduction Columnstore BasicsSQL Server
Columnstore
Non-Clustered Columnstore
Clustered Columnstore
Summary
Non-Clustered Columnstore
• Available in:– SQL Server 2012– SQL Server 2012 Parallel Data Warehouse– SQL Server 2014
• One non-clustered columnstore per table– Support tables heap or clustered index
• Add in all columns from table– No key columns
• Best support star-join style queries• Avoid OUTER JOIN and NOT IN
– Prevent batch processing
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Updating Non-Clustered Columnstore
• Drop the columnstore
• Perform DML
• Recreate columnstore
Drop and Rebuild
• Create new partition with modified data
• Create columnstore
• Switch in partition
Partition Switch
• Apply changes to separate table
• UNION ALL columnstore or change table
• Manage DML through trigger
Partitioned View
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
NON-CLUSTERED COLUMNSTORE
Demo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Agenda
Introduction Columnstore BasicsSQL Server
Columnstore
Non-Clustered Columnstore
Clustered Columnstore
Summary
Clustered Columnstore
• Available in:– SQL Server 2012 Parallel Data Warehouse
– SQL Server 2014
• One clustered columnstore per table– Is primary storage for data
– Reduces space requirements
• Can leverage columnstore archive format
• Same design patterns as non-clustered
• Preferred over non-clustered columnstore
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
CLUSTERED COLUMNSTORE
Demo
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
Agenda
Introduction Columnstore BasicsSQL Server
Columnstore
Non-Clustered Columnstore
Clustered Columnstore
Summary
Summary
• Columnstore indexes change data can be accessed
• Provides increased data compression
• Retrieves only the columns that are needed
• Primary benefit in data warehouses
– Slowly or unchanging data
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
More Information
Expert Performance IndexingFor SQL Server 2012
Jason StrateTed Krueger
OverviewStatistics
MaintenanceTools
Analysis
http://amzn.com/1430237414
MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
ServicesSpeed development through training, and rapid development services from Pragmatic Works.
ProductsBI products to covert to a Microsoft BI platform and simplify development onthe platform.
FoundationHelping those who do not have themeans to get into information technologyachieve their dreams.
For more information…Name: Jason Strate
Email: [email protected]
Blog: www.jasonstrate.com
Resource: jasonstrate.com/go/indexing
Need Help? jasonstrate.com/go/vmdba