Adding Lightness Better Performance through Compression

Slides:



Advertisements
Similar presentations
SQL Server Storage Engine.  Software architect at Red Gate Software  Responsible for SQL tools: ◦ SQL Compare, SQL Data Compare, SQL Packager ◦ SQL.
Advertisements

SQL Server Compression Estimation Presented by Warwick Rudd –
Project Management Database and SQL Server Katmai New Features Qingsong Yao
Tables Lesson 6. Skills Matrix Tables Tables store data. Tables are relational –They store data organized as row and columns. –Data can be retrieved.
Module 6 Implementing Table Structures in SQL Server ®2008 R2.
André Kamman Friday November 20 SQLBITS IV. About Me  André Kamman  > 20 years in IT  Main focus on complex SQL Server environments (or a whole.
Denny Cherry twitter.com/mrdenny.
SQL Data Definition Language (DDL) Using Microsoft SQL Server 1SDL Data Definition Language (DDL)
Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
11 3 / 12 CHAPTER Databases MIS105 Lec15 Irfan Ahmed Ilyas.
Incremental Index Maintenance A Solution “That Just Works” AL NOEL PRINCIPAL CONSULTANT, MICROSOFT
Denny Cherry twitter.com/mrdenny.
Indexes / Session 2/ 1 of 36 Session 2 Module 3: Types of Indexes Module 4: Maintaining Indexes.
Data Types Lesson 4. Skills Matrix Table A table stores your data. Tables are relational in that they are organized as rows and columns (a matrix). Each.
Advanced Web 2012 Lecture 3 Sean Costain What is a Database? Sean Costain 2012 A database is a structured way of dealing with structured information.
SQL Server 2005 Implementation and Maintenance Chapter 3: Tables and Views.
Praveen Srivatsa Director| AstrhaSoft Consulting blogs.asthrasoft.com/praveens |
Sql DDL queries CS 260 Database Systems.
SQLintersection Putting the "Squeeze" on Large Tables Improve Performance and Save Space with Data Compression Justin Randall Tuesday,
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.
1 CS 430 Database Theory Winter 2005 Lecture 11: SQL DDL.
Table Structures and Indexing. The concept of indexing If you were asked to search for the name “Adam Wilbert” in a phonebook, you would go directly to.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
APRIL 13 th Introduction About me Duško Mirković 7 years of experience.
Effective Indexing With Partitioning and Compression Neil Hambly SQL Server Practice Lead PASS Chapters Leader
What is your Character Data Type? March 5, 2016 John Deardurff Website:
Memory-Optimized Tables Querying at the speed of light.
Get your Oracle data into SQL Server faster!
Creating Database Objects
To Compress or Decompress Data
Chris Index Feng Shui Chris
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Managing Tables, Data Integrity, Constraints by Adrienne Watt
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Module 2: Creating Data Types and Tables
Accidental DBA Developer Edition
Lecture 6 Data Model Design (continued)
UFC #1433 In-Memory tables 2014 vs 2016
Data Definition and Data Types
Finding more space for your tight environment
Lesson 7 Managing Data Creating a database with Web Matrix.
Module 4: Creating and Tuning Indexes
Ouch! Our Data Type Choices Did THAT?
Partitioned Tables and Query Performance
Introduction to SQL Server Management for the Non-DBA
Migrating a Disk-based Table to a Memory-optimized one in SQL Server
Proper DataType Usage = Guaranteed Better Performance and Accuracy
EXEC and sp_executesql An Ad Hoc Rally
Table Indexing for the .NET Developer
ColumnStore Index Primer
What is your Character Data Type?
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Working with Data Types
Indexing Fundamentals
Squeeze Into Some Free Gains
Table Partitioning Intro and make that a sliding window too!
Shaving of Microseconds
A JSON’s Journey through SQL Server
PT2520 Unit 5: Physical Design
Data Types Do Matter Start local instance of SQL Start ZoomIt
Table Partitioning Intro and make that a sliding window too!
Clustered Columnstore Indexes (SQL Server 2014)
Squeeze Into Some Free Gains
Table Partitioning Intro and make that a sliding window too!
Creating Database Objects
All about Indexes Gail Shaw.
Introduction to SQL Server and the Structure Query Language
When to use indexing pro Features
Presentation transcript:

Adding Lightness Better Performance through Compression SQL Saturday #474 - Salt Lake City Jay Robinson jrobinson@salesforce.com | @downshiftdata

Thanks to our Sponsors! Yearly Partners Gold Sponsors

Adding Lightness: A Thesis Data compression in SQL Server is not a strategy for consuming less disk space. It is a strategy for improving performance. This session will cover how it works, how to use it, when to use it, and how to take it into consideration when designing your data architecture.

The Obligatory Bio Page Jay Robinson Senior Systems Engineer, Salesforce Marketing Cloud (formerly ExactTarget) Supporting hundreds of instances of SQL Server across multiple data centers Email: jrobinson@salesforce.com Twitter: @downshiftdata Blog: downshiftdata.wordpress.com

“Simplify, then add lightness” Colin Chapman, Founder of Lotus With Jim Clark in the Lotus 49 after winning the 1967 Dutch Grand Prix at Zandvoort, the car’s first race.

1. Who Can Use It? Introduced in SQL Server 2008 Only available in Enterprise and Developer Editions (and 2008 R2’s Datacenter Edition) From MSDN: “The details of data compression are subject to change without notice in service packs or subsequent releases.”

2. What Will It NOT Do? Compress system tables Change the maximum row size on a page from 8060 bytes Compress a table when the overhead pushes the row size past 8060 Compress LOB pages?!?!

3. How Is It Added? For new tables and indexes... CREATE TABLE table_name (...) WITH (DATA_COMPRESSION = ROW|PAGE); CREATE INDEX index_name ON table_name (...) WITH (DATA_COMPRESSION = ROW|PAGE, ONLINE = ON); For existing tables and indexes... ALTER TABLE table_name REBUILD ALTER INDEX index_name ON table_name REBUILD

4. What Is Row Compression? Meta overhead is reduced (usually) Blanks removed from fixed strings Smaller data types are used Some types benefit, others do not. Beneficiaries: smallint, int, bigint, decimal, numeric, bit, smallmoney, money, float, real, datetime, datetime2, datetimeoffset, char, nchar, binary, timestamp

5. What Is Page Compression? LastName Smith Smithfield Smithwick &1 = “Smith” Page compression includes: Row compression Prefix compression Repeated string prefixes are replaced with a pointer to the prefix in the page header Dictionary compression Repeated strings are replaced with a pointer to the string in the page header Occurs when pages are full and a row is added Leaf level only LastName &1 &1field &1wick Address 123 Cherry St. 456 Cherry Ln. 78 Cherry Ave. 90 Cherry Rd. &2 = “ Cherry ” Address 123&2St. 456&2Ln. 78&2Ave. 90&2Rd.

6. How Are Indexes Compressed? The table (aka clustered index) and each non-clustered index can be compressed differently (none, row, or page). Reminder: leaf nodes of the non-clustered index contain all clustered index columns and included columns. Column Data Type Index SiteId int clustered, primary key SiteName varchar(100) Url nvarchar(256) non-clustered Url Url, SiteId

7. How Are Heaps Compressed? Heaps will only use PAGE compression under certain (odd) circumstances: Bulk operations ALTER TABLE ... REBUILD A compressed clustered index is applied then removed Non-clustered indexes will need to be rebuilt to reset the page pointers

8. What About Other Caveats? Indexed views can also be compressed Partitioned tables and indexes have each partition compressed separately Columnstore tables and indexes have their own compression Not configurable Can be further compressed with archival compression Not compatible with sparse columns

9. How Much Will You Gain? SQL Server 2014 + only EXEC dbo.sp_estimate_data_compression_savings @schema_name = N'Sales', @object_name = N'SalesOrderDetail', @index_id = 1, @partition_number = 1, @data_compression = 'PAGE';

sp_estimate_data_compression_savings DEMO sp_estimate_data_compression_savings

10. Why Does It Matter? Which wait types are more prevalent in your system? PAGEIOLATCH_SH and PAGEIOLATCH_EX SOS_SCHEDULER_YIELD Compression is a trade-off of CPU time for disk space. Most of our systems are IO-bound, not CPU-bound. We can afford this trade-off!

No Compression versus Row Compression Page Compression DEMO No Compression versus Row Compression Page Compression

Thank You! "Adding power makes you faster on the straights; subtracting weight makes you faster everywhere“ - Colin Chapman Don’t Forget The Survey! Jay Robinson Email: jrobinson@salesforce.com Twitter: @downshiftdata Blog: downshiftdata.wordpress.com