Introduction to Columnstore Indexes

1,301 views

Published on

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

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,301
On SlideShare
0
From Embeds
0
Number of Embeds
439
Actions
Shares
0
Downloads
34
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction to Columnstore Indexes

  1. 1. Introduction to Columnstore Indexes
  2. 2. Jason Strate e: jstrate@pragmaticworks.com e: jasonstrate@gmail.com b: www.jasonstrate.com t: StrateSQL Resources jasonstrate.com/go/indexing Introduction MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  3. 3. 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 FY13 Frontline Partnership Partner of the Year for Big Data Executive 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
  4. 4. MAKING BUSINESS INTELLIGENT www.pragmaticworks.com Everyone wants fast queries
  5. 5. MAKING BUSINESS INTELLIGENT www.pragmaticworks.com Sometimes Normal Doesn’t Make Sense
  6. 6. We need to change what we do
  7. 7. MAKING BUSINESS INTELLIGENT www.pragmaticworks.com To get things back to normal
  8. 8. Agenda Introduction Columnstore Basics SQL Server Columnstore Non-Clustered Columnstore Clustered Columnstore Summary
  9. 9. Agenda Introduction Columnstore Basics SQL Server Columnstore Non-Clustered Columnstore Clustered Columnstore Summary
  10. 10. 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
  11. 11. Agenda Introduction Columnstore Basics SQL Server Columnstore Non-Clustered Columnstore Clustered Columnstore Summary
  12. 12. 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
  13. 13. 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
  14. 14. MAKING BUSINESS INTELLIGENT www.pragmaticworks.com Say What?!
  15. 15. Traditional Index MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  16. 16. Columnstore Index MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  17. 17. Columnstore Index MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  18. 18. 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
  19. 19. Agenda Introduction Columnstore Basics SQL Server Columnstore Non-Clustered Columnstore Clustered Columnstore Summary
  20. 20. 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
  21. 21. 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 – Readwrite when clustered MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  22. 22. Batch-mode Processing MAKING BUSINESS INTELLIGENT www.pragmaticworks.com 1 record versus 415 records
  23. 23. 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
  24. 24. Agenda Introduction Columnstore Basics SQL Server Columnstore Non-Clustered Columnstore Clustered Columnstore Summary
  25. 25. 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
  26. 26. 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
  27. 27. NON-CLUSTERED COLUMNSTORE Demo MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  28. 28. Agenda Introduction Columnstore Basics SQL Server Columnstore Non-Clustered Columnstore Clustered Columnstore Summary
  29. 29. 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
  30. 30. CLUSTERED COLUMNSTORE Demo MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  31. 31. Agenda Introduction Columnstore Basics SQL Server Columnstore Non-Clustered Columnstore Clustered Columnstore Summary
  32. 32. 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
  33. 33. More Information Expert Performance Indexing For SQL Server 2012 Jason Strate Ted Krueger Overview Statistics Maintenance Tools Analysis http://amzn.com/1430237414 MAKING BUSINESS INTELLIGENT www.pragmaticworks.com
  34. 34. Services Speed development through training, and rapid development services from Pragmatic Works. Products BI products to covert to a Microsoft BI platform and simplify development on the platform. Foundation Helping those who do not have the means to get into information technology achieve their dreams. For more information… Name: Jason Strate Email: jstrate@pragmaticworks.com Blog: www.jasonstrate.com Resource: jasonstrate.com/go/indexing Need Help? jasonstrate.com/go/vmdba

×