Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy.

Slides:



Advertisements
Similar presentations
Adam Jorgensen Pragmatic Works Performance Optimization in SQL Server Analysis Services 2008.
Advertisements

Data Management and Index Options for SQL Server Data Warehouses Atlanta MDF.
SQL Server 2012 Data Warehousing Deep Dive Dejan Sarka, SolidQ
Big Data Working with Terabytes in SQL Server Andrew Novick
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)
The Baker’s Dozen Business Intelligence 13 Tips for the SQL Server Columnstore Index Kevin S. Goff Microsoft SQL Server MVP.
Agenda 10 Key SQL 2012 BI Innovations BI Semantic Model Project ‘Apollo’ Vertipaq xVelocity in SQL 2012.
Making Data Warehouse Easy Conor Cunningham – Principal Architect Thomas Kejser – Principal PM.
Architecting a Large-Scale Data Warehouse with SQL Server 2005 Mark Morton Senior Technical Consultant IT Training Solutions DAT313.
Jim McLeod MyDBA  SQL Server Performance Tuning Consultant with MyDBA  Microsoft Certified Trainer with SQLskills Australia 
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
Columnstore Indexes in SQL Server 2012 Conor Cunningham Principal Architect, Microsoft SQL Server Representing Microsoft Development.
Oracle Advanced Compression – Reduce Storage, Reduce Costs, Increase Performance Session: S Gregg Christman -- Senior Product Manager Vineet Marwah.
SQL Server Indexes Indexes. Overview Indexes are used to help speed search results in a database. A careful use of indexes can greatly improve search.
Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
Denny Cherry twitter.com/mrdenny.
SQL SERVER DAYS 2011 Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
INTRODUCING SQL SERVER 2012 COLUMNSTORE INDEXES Exploring and Managing SQL Server 2012 Database Engine Improvements.
2012 © Trivadis BASEL BERN LAUSANNE ZÜRICH DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. HAMBURG MÜNCHEN STUTTGART WIEN Welcome November 2012 Columnstore Indexes.
Sofia Event Center November 2013 Margarita Naumova SQL Master Academy.
Best Practices in Loading Large Datasets Asanka Padmakumara (BSc,MCTS) SQL Server Sri Lanka User Group Meeting Oct 2013.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
Boosting DWH-Performance with SQL Server 2016 ColumnStore Index.
--A Gem of SQL Server 2012, particularly for Data Warehousing-- Present By Steven Wang.
SQLUG.be Case study: Redesign CDR archiving on SQL Server 2012 By Ludo Bernaerts April 16,2012.
Strategies for Working with Texas-sized Databases Robert L Davis Database Engineer
Execution Plans Detail From Zero to Hero İsmail Adar.
Turbocharge your DW Queries with ColumnStore Indexes Susan Price Senior Program Manager DW and Big Data.
Does the Optimistic Concurrency resolve your blocking problems Margarita Naumova, SQL Master Academy.
Oracle Announced New In- Memory Database G1 Emre Eftelioglu, Fen Liu [09/27/13] 1 [1]
Best Practices for Columnstore Indexes Warner Chaves SQL MCM / MVP SQLTurbo.com Pythian.com.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Memory-Optimized Tables Querying at the speed of light.
Introduction to columnstore indexes Taras Bobrovytskyi SQL wincor nixdorf.
Data Warehouse ETL By Garrett EDmondson Thanks to our Gold Sponsors:
Top 10 DBA mistakes that affect the SQL Server performance
Columnstore Indexing: From SQL Server 2012 to SQL Server 2014
In-Memory Capabilities
Temporal Databases Microsoft SQL Server 2016
Temporal Databases Microsoft SQL Server 2016
UFC #1433 In-Memory tables 2014 vs 2016
T-SQL: Simple Changes That Go a Long Way
Taking your application to memory
Database Performance Tuning and Query Optimization
Four Rules For Columnstore Query Performance
The Five Ws of Columnstore Indexes
Database Administration for the Non-DBA
Blazing-Fast Performance:
Migrating a Disk-based Table to a Memory-optimized one in SQL Server
Table Indexing for the .NET Developer
ColumnStore Index Primer
Azure SQL Data Warehouse Performance Tuning
Introduction to columnstore indexes
TechEd /20/ :49 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Physical Database Design
20 Questions with Azure SQL Data Warehouse
11/29/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Steve Hood SimpleSQLServer.com
TechEd /2/2018 7:32 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
The Five Ws of Columnstore Indexes
Sunil Agarwal | Principal Program Manager
Four Rules For Columnstore Query Performance
Clustered Columnstore Indexes (SQL Server 2014)
Chapter 11 Database Performance Tuning and Query Optimization
Using Columnstore indexes in Azure DevOps Services. Lessons learned
Using Columnstore indexes in Azure DevOps Services. Lessons learned
SQL Server Columnar Storage
All about Indexes Gail Shaw.
Using Columnstore indexes in Azure DevOps Services. Lessons learned.
Sunil Agarwal | Principal Program Manager
Presentation transcript:

Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy

Agenda What is a columnstore index How it works Limits and restrictions When and how to use it

Working with SQL Server from v6.5 MCT from 1998 SQL Server Trainer and Consultant with over 50 projects in Bulgaria, Finland, Germany, UK, Greece.. 5 years Senior Consultant in Microsoft, member of Microsoft Worldwide Technical Leadership Team Microsoft Certified Master SQL Server 2008 BG SQL UG Leader MVP SQL Server Now teaching and presenting SQL Server, running SQL Master Academy Training Program About me

What is a Columnstore Index A new column store in SQL Server Database Engine Advanced Query processing techniques Accelerates specific workloads (DW)

Performance Example of CSI 1TB DW Database, 1.44 billion rows in fact table, 32 logical procs with 256GB RAM

DEMO CSI Performance Example

A columnstore Index Structure Stores data column-wise Better compression –Uses VertiPaq compression technology Less IO –Better Buffer hit rates Pure Column Store Fetches only needed columns from disk Only needed cols are fetched Segment (values for 1 col for a set of about 1mnl of rows)

Advanced Query processing techniques Processing mode –Batch mode –Row mode Best performance - when processes column data in batches using highly efficient algorithms Optimizer makes a cost based decision Segment elimination is an additional optimization Optimizer allows you to use hints

DEMO CSI Internals

DO’s for using CSI Effectively Put CSI on large tables only –Large fact tables and very large dimension table Include every column of the table in the columnstore index Use in read mostly workload, where most updates are appending new data Workflow permits using partitioning (or drop rebuild index) to handle new data Structure your queries as star joins with grouping and aggregation as much as possible or entail scanning and aggregating large amounts of data

ColumnStore Index Optimizations Rules DOP>2 and enough memory On ColumnStore indexed tables avoid using: –joins and filters on string columns –OUTER JOIN –NOT IN ( ) –UNION ALL to directly combine columnstore-indexed tables with other tables

Loading data Table with columnstore index can be read, not updated –INSERT, UPDATE, DELETE and MERGE is not allowed –Partition switching is allowed There are three possible methods for loading data –Disabling index –Partition switching –UNION ALL (tickle update)

Loading Method 1 Disable (or drop) the index –ALTER INDEX ….DISABLE Update the table Rebuild the columnstore index ALTER INDEX … REBUILD

Loading Method 2 Load new data into a staging table Build a columnstore index on the staging table –CREATE NONCLUSTERED COLUMNSTORE INDEX myindex ON Staging(……) Switch the partition into the main table –ALTER TABLE Staging SWITCH TO PARTITION 5 5/11 Staging table Load Switch

DEMO Loading and updating data in CSI

Loading Method 3 Build CSI index on primary table Create staging/delta table with no CSI Insert new data into (row-based) delta table Query both tables using UNION ALL to combine the results –Perform local-global aggregation using CTE aggregate the data from the columnstore and from the delta table in separate queries combine the results with a second level of grouping and aggregation –Do not make a view with UNION ALL Keep delta table small

Other Usage and limitations Must have a base table structure – heap or Clustered Index CSI is not appropriate for lookups, seeks and in OLTP as a general workload type Supported data types should be <8 Bytes The following data types cannot be included in a columnstore index: –binary and varbinary, ntext, text, and image –varchar(max) and nvarchar(max) –Uniqueidentifier, rowversion (and timestamp) –decimal (and numeric) with precision greater than 18 digits –datetimeoffset with scale greater than 2 –CLR types (hierarchyid and spatial types), xml

Good news Most things just work with columnstore indexes –Backup and restore –Mirroring –Log Shipping –SSMS –Administration tools –TDE

CSI Summary Benefits –Interactive experience with data Near instant response times Ad hoc queries Large data sets –Easy to set up No need for summary tables, indexed views Fewer indexes to design, create and maintain Reduces need to manually tune queries Consider limitation in V1 and overcome with –Good coding practices to achieve batch processing –Respective method of loading data

Thank you! Margarita Naumova| SQL Master Academy