Four Rules For Columnstore Query Performance

Slides:



Advertisements
Similar presentations
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Advertisements

SQL SERVER 2012 XVELOCITY COLUMNSTORE INDEX Conor Cunningham Principal Architect SQL Server Engine.
SQL Performance 2011/12 Joe Chang, SolidQ
Dos and don’ts of Columnstore indexes The basis of xVelocity in-memory technology What’s it all about The compression methods (RLE / Dictionary encoding)
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 11 Database Performance Tuning and Query Optimization.
Architecting a Large-Scale Data Warehouse with SQL Server 2005 Mark Morton Senior Technical Consultant IT Training Solutions DAT313.
Chapter 3 Single-Table Queries
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
September 2011Copyright 2011 Teradata Corporation1 Teradata Columnar.
Columnstore Indexes in SQL Server 2012 Conor Cunningham Principal Architect, Microsoft SQL Server Representing Microsoft Development.
Applications hitting a wall today with SQL Server Locking/Latching Scale-up Throughput or latency SLA Applications which do not use SQL Server.
1 Single Table Queries. 2 Objectives  SELECT, WHERE  AND / OR / NOT conditions  Computed columns  LIKE, IN, BETWEEN operators  ORDER BY, GROUP BY,
C-Store: How Different are Column-Stores and Row-Stores? Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY May. 8, 2009.
Parallel Execution Plans Joe Chang
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
Chapter 4 Indexes. Index Architecture  By default data is inserted on a first-come, first-serve basis  Indexes bring order to this chaos  Once you.
INTRODUCING SQL SERVER 2012 COLUMNSTORE INDEXES Exploring and Managing SQL Server 2012 Database Engine Improvements.
IMS 4212: Database Implementation 1 Dr. Lawrence West, Management Dept., University of Central Florida Physical Database Implementation—Topics.
Page 1 © Hortonworks Inc – All Rights Reserved Hive: Data Organization for Performance Gopal Vijayaraghavan.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
--A Gem of SQL Server 2012, particularly for Data Warehousing-- Present By Steven Wang.
How to kill SQL Server Performance Håkan Winther.
6/13/2015 Visit the Sponsor tables to enter their end of day raffles. Turn in your completed Event Evaluation form at the end of the day in the Registration.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Execution Plans Detail From Zero to Hero İsmail Adar.
Honest Bob’s Cube Processing Bob Duffy Database Architect.
Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy.
Best Practices for Columnstore Indexes Warner Chaves SQL MCM / MVP SQLTurbo.com Pythian.com.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Introduction to Partitioning in SQL Server
SQL Server Statistics and its relationship with Query Optimizer
In-Memory Capabilities
Power BI Performance Tips & Tricks
Indexes By Adrienne Watt.
Query Tuning without Production Data
Finding more space for your tight environment
Query Tuning without Production Data
Query Tuning without Production Data
Columnstore Index - is it the DW "Faster" switch you are looking for?
Database Performance Tuning and Query Optimization
Four Rules For Columnstore Query Performance
The Five Ws of Columnstore Indexes
Blazing-Fast Performance:
Introduction to Execution Plans
Using Indexed Views & Computed Columns for Performance !
Decoding the Cardinality Estimator to Speed Up Queries
PREMIER SPONSOR GOLD SPONSORS SILVER SPONSORS BRONZE SPONSORS SUPPORTERS.
Cardinality Estimator 2014/2016
ColumnStore Index Primer
Azure SQL Data Warehouse Performance Tuning
Sidharth Mishra Dr. T.Y. Lin CS 257 Section 1 MH 222 SJSU - Fall 2016
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Steve Hood SimpleSQLServer.com
Microsoft SQL Server 2014 for Oracle DBAs Module 7
The Five Ws of Columnstore Indexes
Data Analysis with SQL Window Functions
Sunil Agarwal | Principal Program Manager
M1G Introduction to Database Development
Chapter 11 Database Performance Tuning and Query Optimization
Execution plans Eugene
Diving into Query Execution Plans
Introduction to Execution Plans
Using Columnstore indexes in Azure DevOps Services. Lessons learned
Using Columnstore indexes in Azure DevOps Services. Lessons learned
Introduction to Execution Plans
SQL Server Columnar Storage
Using Columnstore indexes in Azure DevOps Services. Lessons learned.
Sunil Agarwal | Principal Program Manager
An Introduction to Partitioning
Presentation transcript:

Four Rules For Columnstore Query Performance Joe Obbish

About Me Business Intelligence Developer for EHR company Answer questions on dba.stackexchange.com Blog about SQL Server at https://orderbyselectnull.com/ Done performance tuning for thousands of queries

Scope I work with data warehouses that use on-disk clustered columnstore indexes with very few nonclustered indexes. Material applies to SQL Server 2016 and 2017.

The Consequences of Creative T-SQL Creative code can enter your database in many different ways: Your (least) favorite third party reporting tool. Your (least) favorite end user. Your (least) favorite developer using an ORM. Creative code can have different consequences with CCIs compared to rowstore.

The Four Rules Take Advantage of Columnstore Features Define and Maintain your Table Get Batch Mode Avoid Some Query Patterns

Take Advantage of Columnstore Features Column elimination Rowgroup elimination Aggregate pushdown String predicate pushdown

Column Elimination Compressed data is stored in columnar format. SELECT * is worse than ever. UPDATE queries need to read all columns.

Rowgroup Elimination “To determine which rows groups to eliminate, the columnstore index uses metadata to store the minimum and maximum values of each column segment for each rowgroup. When none of the column segment ranges meet the query predicate criteria, the entire rowgroup is skipped without doing any actual IO.” Doesn’t work for string data types.

Aggregate Pushdown Calculate some aggregates at the scan level. MIN, MAX, AVG, SUM, COUNT, COUNT_BIG Only works for exact numeric data types that fit within 8 bytes. Might not work depending on characteristics of compressed data. Trivial plans can cause issues in SQL Server 2016.

String Predicate Pushdown “With string predicate pushdown, the query execution computes the predicate against the values in the dictionary and if it qualifies, all rows referring to the dictionary value are automatically qualified.” Including for completeness (no demos).

Demos 1

The Four Rules Take Advantage of Columnstore Features Define and Maintain your Table Get Batch Mode Avoid Some Query Patterns

Is This Bad?

Do Index Maintenance Columnstore maintenance is very different from rowstore index maintenance. Skipping maintenance can result in reduced query performance, hundreds of wasted GBs of space, and other problems.

Use the Right Data Types Use data types that fit your data as closely as possible. Different data types have different levels of support for columnstore query performance features.

Be Smart About Partitioning Partitioning is essential for not small columnstore indexes. Partitioning can actually improve query performance on columnstore indexes! Avoid partition schemes that are too small or that don’t fit well with your load method.

Demos 2

The Four Rules Take Advantage of Columnstore Features Define and Maintain your Table Get Batch Mode Avoid Some Query Patterns

Batch Mode Query plan operators can process sets of rows at a time instead of operating row by row. Operate on compressed data directly. Take advantage of fancy CPU features. Avoid expensive row mode exchange operators.

Supported Operators Supported operators change by version, but nothing new in SQL Server 2017. Supported operators: columnstore scan hash match compute scalar sort concatenation top sort filter window aggregates

Watch out for Batch Mode Sorts You should generally be happy to see batch mode operators except for batch mode sorts in some scenarios. Microsoft’s implementation of batch mode sorts arguably isn’t complete yet and can lead to performance problems. TF 9347 disables them.

Stay Current on CUs Microsoft has released many important bug fixes related to Columnstore since 2016 SP1 base. Don’t stay on 2016 SP1 base!

Relevant KBs KB 3210747 KB 4013118 KB 4019718 KB 4046858 KB 3208460 VSTS 11704339 KB 3211602 KB 4018866 KB 4024311 KB 4010984 KB 4019028 KB 4040014 KB 3195752 KB 4017154 KB 4040276 KB 3195825 KB 4015034 KB 4024860 KB 3216543 KB 4013111 KB 4039735 KB 3202425 KB 4016946 KB 4052133

Demos 3

The Four Rules Take Advantage of Columnstore Features Define and Maintain your Table Get Batch Mode Avoid Some Query Patterns

Some Queries Really Need NCIs String aggregation doesn’t work well with CCIs until SQL Server 2017. Not all joins are eligible for hash join. Recursive queries are not a good match for CCIs.

Ruinous Row Goals Think how a query plan might change if you add TOP 1 to it. Blocking operators, such as many of those eligible for batch mode, become less attractive. Arguably CCIs are incompatible with most row goal optimizations.

Demos 4

The Four Rules Take Advantage of Columnstore Features Define and Maintain your Table Get Batch Mode Avoid Some Query Patterns

Resources Columnstore indexes - Query performance Niko Neugebauer’s blog Row Goal Series by Paul White CCIs And Recursive CTEs by Erik Darling Aggregate Pushdown Limitations

Please Fill Out Feedback Forms