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.

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

Big Data Working with Terabytes in SQL Server Andrew Novick
SQL Server Compression Estimation Presented by Warwick Rudd –
Help! My table is getting too big! How to divide and conquer SQL Relay 2014.
10 Things Not To Do With SQL SQLBits 7. Some things you shouldn’t do.
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.
File Systems Implementation
Recap of Feb 27: Disk-Block Access and Buffer Management Major concepts in Disk-Block Access covered: –Disk-arm Scheduling –Non-volatile write buffers.
SQL Server Storage and Index Structures Physical Data Organization Indexes B-Trees SQL Server Data Access Clustered and Non-Clustered Creating, Altering,
Backup, Integrity Check and Index and Statistics Maintenance
Denny Cherry twitter.com/mrdenny.
SQL Server 2008: What to do and What not to do Eladio Rincón Javier Loria Solid.
SQL Server 2008 Implementation and Maintenance Chapter 7: Performing Backups and Restores.
Exam QUESTION CertKiller.com has hired you as a database administrator for their network. Your duties include administering the SQL Server 2008.
Chapter 2: Designing Physical Storage MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design Study Guide (70-443)
Databases Lesson 5.
Architecture Rajesh. Components of Database Engine.
March 16 & 21, Csci 2111: Data and File Structures Week 9, Lectures 1 & 2 Indexed Sequential File Access and Prefix B+ Trees.
Chapter 4 Memory Management.
Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
Denny Cherry twitter.com/mrdenny.
SQL Server 2005 Implementation and Maintenance Chapter 12: Achieving High Availability Through Replication.
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.
MISSION CRITICAL COMPUTING SQL Server Special Considerations.
LAYERED PARTITIONING Josip Šaban, Hypo Alpe Adria AG, Klagenfurt.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
How to kill SQL Server Performance Håkan Winther.
# CCNZ What is going on here???
Strategies for Working with Texas-sized Databases Robert L Davis Database Engineer
October 15-18, 2013 Charlotte, NC SQL Server Index Internals Tim Chapman Premier Field Engineer.
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
Database Administration for the Non-DBA Denny Cherry twitter.com/mrdenny.
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 Server Storage Inside. About Hemantgiri S. Goswami Hemantgiri S. Goswami is a Lead Database Consultant for Pythian, a company head quartered in Ottawa,
Chris Index Feng Shui Chris
In-Memory Capabilities
Inside transaction logging
Curacao SQL Saturday June 11, 2016
Record Storage, File Organization, and Indexes
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Module 2: Creating Data Types and Tables
Finding more space for your tight environment
Designing Database Solutions for SQL Server
Database Management Systems (CS 564)
Installation and database instance essentials
Introduction to SQL Server Management for the Non-DBA
Database Administration for the Non-DBA
SQL Server May Let You Do It, But it Doesn’t Mean You Should
SQL 2014 In-Memory OLTP What, Why, and How
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Re-Indexing - The quest of ultimate automation
Squeeze Into Some Free Gains
Inside transaction logging
In Memory OLTP Not Just for OLTP.
Adding Lightness Better Performance through Compression
It’s TEMPDB Why Should You Care?
Clustered Columnstore Indexes (SQL Server 2014)
Squeeze Into Some Free Gains
The Ins and Outs of Indexes
In Memory OLTP Not Just for OLTP.
File System Implementation
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
The Ins and Outs of Indexes
Hybrid Buffer Pool The Good, the Bad and the Ugly
When to use indexing pro Features
Presentation transcript:

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 lot of less complex ones)  Co-founder, current chairman of Dutch PASS Chapter (sqlpass.nl)  Organizing Committee for the PASS European Conference

Agenda  Why compress ?  Backup Compression  Data Compression Row, Page, Unicode (R2)  How to choose  How to implement  Maintainability

Why Compress ?  Disk throughput (a lot) slower than memory and CPU  David DeWitt keynote at PASS Summit : Since 1985 CPU x 1000 faster Since 1985 Disk x 65 (!) faster Much larger capacity for disks but bandwith and seek times not so much result in a 150 x relatively slower disk.  Need less disk space

Backup Compression  Enterprise & Developer Edition only Can restore to Standard Edition  Also in Standard Edition starting at R2 !  Closest to the data, generally better than compressing when copying or deduping on the san for instance.  Lots of competition from Quest, Redgate, Idera, Hyperbac, etc.  Still adds value after implementing Data Compression

Row Compression  Stores fixed length types as variable length. (with improved overhead)  i.e.: int (4 bytes) can be stored in 1 byte if the value is low enough  Makes vardecimal obsolete. Can still be used but is deprecated.

Good to know  Compression also in memory  Implications on replication  Transaction log, Version store and Non- leaf pages stored row compressed only  Can’t restore to standard edition  Fix : KB Compression is removed after shrink  Don’t shrink ! Or at least mind the fragmentation !

Page Compression Page Header aaabbaaaababcd aaabccbbbbabcd aaacccaaaaccbbbb 4b 3ccc 0bbbb Pre-FixDictionary

Unicode Compression in SQL Server 2008 R2  SCSU Simple Compression Scheme for Unicode Data  Uses 1 byte instead of 2 when it can.

How to Choose - Effectiveness  Good Compression  Numeric or fixed length character fields that don’t use all the allocated bytes  Repeating data or prefix values  Poor or no Compression  Fields using up all the allocated bytes  Not much repeated data  Repeated with non- repeating prefixes  Out of row data  FILESTREAM data

How to choose  sp_estimate_data_compression_savings  Quick Rule of thumb : ROW is lowcost, generally 10% CPU overhead. Use it on everything on OLTP PAGE is more expensive, but compresses more. Us it on everything on DWH  Analyze Workload Characteristics (to help decide on Page Compression candidates)

Example of decision matrix

How to Implement  Table, Index, Partition  Create, alter …rebuild  Can only set ROW or PAGE  Mind tempspace, cpu etc. This is just like an Index Rebuild  Mind cpu even more with ONLINE option

CREATE TABLE T1 (c1 int, c2 nvarchar(50) ) WITH (DATA_COMPRESSION = ROW) CREATE TABLE PartitionTable1 (col1 int, col2 varchar(max)) ON myRangePS1 (col1) WITH ( DATA_COMPRESSION = ROW ON PARTITIONS (1), DATA_COMPRESSION = PAGE ON PARTITIONS (2 TO 4) ); GO

ALTER TABLE T1 REBUILD WITH (DATA_COMPRESSION = PAGE); GO ALTER TABLE PartitionTable1 REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = PAGE ON PARTITIONS(1) ) ; GO ALTER TABLE PartitionTable1 REBUILD PARTITION = ALL WITH ( DATA_COMPRESSION = PAGE ON PARTITIONS(1), DATA_COMPRESSION = ROW ON PARTITIONS(2 TO 4) ) ; GO

ALTER INDEX IX_INDEX_1 ON T1 REBUILD WITH ( DATA_COMPRESSION = PAGE ) ; GO ALTER INDEX IX_PartTab2Col1 ON PartitionTable1 REBUILD PARTITION = ALL WITH ( DATA_COMPRESSION = PAGE ON PARTITIONS(1), DATA_COMPRESSION = ROW ON PARTITIONS(2 TO 4) ) ; GO

Maintainability - Monitor  Perfmon Page compression attempts/sec Pages compressed/sec (SQL Server, Access Methods object)  Sys.dm_db_index_operational_stats  Sys.dm_db_persisted_sku_features  Sys.partitions (column data_compression_desc)

Maintenance  Heap Pages are only compressed when bulk inserted, inserted with tablock or rebuild  Table with clustered index Pages are compressed when page is full. (before page split is attempted)

Contact me :   Twitter  Blog :  This presentation :   Or just stop me when you run into me

Links / Resources  SQLCAT.com whitepaper :  strategy-capacity-planning-and-best-practices.aspx (Couple of very useful links to blogs etc. inside this whitepaper!) strategy-capacity-planning-and-best-practices.aspx  Storage Engine Team Blog on Compression :  ion/default.aspx ion/default.aspx  Don’t shrink :  OFF!.aspx OFF!.aspx  your-data-files.aspx your-data-files.aspx