SlideShare une entreprise Scribd logo
1  sur  8
Advanced Index, Partitioning and
Compression Strategies for
SQL Server
Neil Hambly
Senior DBA & Engineer,
Confio Software
8/16/2013 1
Who Am I?
• Senior DBA/Engineer for Confio Software
– NeilHambly@confio.com {Based in the UK}
• DBA – 14+ Years, SQL Server 6.5 - 2012
• Held # of DB roles @ many leading organizations
• Regular International PASS Presenter @
SQL Conferences, User-Groups & Webinars
• SQL London PASS Chapter Leader, UK Events Organizer
• Regular @ UK & International community events
• Twitter: @Neil_Hambly & @Confio Contributing Author
• Articles @ Confio.com & My blog
8/16/2013 2
Agenda
• Talk about the two features – Compression & Partitioning
• Using Data Compression in SQL Server 2005+
– Compression
• Editions, Data types
• Vardecimal Compression (2005 SP2)
• Page | Row Compression (2008+)
• Unicode Compression
• Estimate space & resources
– Partitioning
– Combining with other features
– Demos
• Partition-Info Script
• Finding objects for compression
• Q&A + further links
8/16/2013 3
Data Types
8/16/2013 4
Data Compression was introduced in SQL 2005 (SP2) via vardecimal storage
This was superseded in SQL Server in 2008 Version (Row & Page level)
Compression feature is only available in Enterprise and Developer SKU’s
Note: NULL and 0 values across all data types are optimized to take 0 bytes in addition to 4 bits/per Column
Data Type / Benefits with Data Compression
Yes – depends on data No or little benefit (Normally)
bit / smallint / int / bigint tinyint / uniqueidentifier
decimal / numeric
datetime / datetime2 / datetimeoffset smalldatetime / date / time
char / nchar / nvarchar varchar / text / ntext / image
binary / timestamp / Rowversion varbinary
money / smallmoney
float / real
sql_variant / FileStream
cursor / table / xml
SQL Server 2005 SP2
(Vardecimal)
The vardecimal works the same way as the varchar works
for efficiently storing alphanumeric data.
8/16/2013 5
HOW TO TURN ON THE VARDECIMAL OPTION
Step 1:
exec sp_db_vardecimal_storage_format '<dbname>', 'ON'
This option will enable the vardecimal storage on the specified database.
Step 2:
exec sp_tableoption '<table>', 'vardecimal storage format', 1
This option will turn on the vardecimal storage for the existing table.
HOW TO ESTIMATE WHETHER IT IS WORTH TURNING
ON THIS OPTION
sys.sp_estimated_rowsize_reduction_for_vardecimal '<table>'
Column
precision
Original fixed
decimal size
(bytes)
Maximum
vardecimal
data area
(bytes)
Overhead
to store
offset
(bytes)
Maximum
vardecimal
storage
used (bytes)
1-3 5 3 2 5
4-6 5 4 2 6
7-9 5 5 2 7
10-12 9 6 2 8
13-15 9 8 2 10
16-18 9 9 2 11
19 9 10 2 12
20-21 13 10 2 12
22-24 13 11 2 13
25-27 13 13 2 15
28 13 14 2 16
29-30 17 14 2 16
31-33 17 15 2 17
34-36 17 16 2 18
37-38 17 18 2 20
Page & Row Level Compression
8/16/2013 6
Since 2008 version, we have new compression algorithms available
Compressing the leaf level of tables and indexes with page compression consists of
three operations, these are done in the following order:
1. Row compression
2. Prefix compression
3. Dictionary compression
Note: When using page compression, the non–leaf-level pages of indexes are only row compressed
Row Compression Prefix Compression Dictionary Compression
Unicode Compression
Space savings that can be achieved for different locales (15-50%)
8/16/2013 7
Standard Compression Scheme for Unicode
(SCSU) SCSU algorithm to compress Unicode
values that are stored in row or page
compressed objects
Unicode compression supports the fixed-
length nchar(n) and nvarchar(n) data types.
Data values that are stored off row or in
nvarchar(max) columns are not compressed
Locale Compression %
English 50%
German 50%
Hindi 50%
Turkish 48%
Vietnamese 39%
Japanese 15%
SCSU can also switch to UTF-16 internally to handle non-alphabetic languages
Supercharge SQL Server Performance with
Indexing, Partitioning and Compression
View this full 60-minute webinar, compliments of Confio Software,
to supercharge SQL Server performance using advanced techniques
for indexing, partitioning and/or compression. You’ll learn:
• How to identify which objects will benefit the most from
indexing
• How to decide when you should combine indexing, partitioning
and compression
• How these techniques have been applied in real-world scenarios
• How to you can use available demo scripts to determine which
objects in your environment will benefit from these techniques
www.confio.com
8/16/2013 8

Contenu connexe

Tendances

in-memory database system and low latency
in-memory database system and low latencyin-memory database system and low latency
in-memory database system and low latency
hyeongchae lee
 

Tendances (15)

NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 
MySQL vs. MonetDB
MySQL vs. MonetDBMySQL vs. MonetDB
MySQL vs. MonetDB
 
Scalability
ScalabilityScalability
Scalability
 
MySQL vs MonetDB Bencharmarks
MySQL vs MonetDB BencharmarksMySQL vs MonetDB Bencharmarks
MySQL vs MonetDB Bencharmarks
 
MongoDB Datacenter Awareness (mongosf2012)
MongoDB Datacenter Awareness (mongosf2012)MongoDB Datacenter Awareness (mongosf2012)
MongoDB Datacenter Awareness (mongosf2012)
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
Big Data Day LA 2015 - HBase at Factual: Real time and Batch Uses by Molly O'...
Big Data Day LA 2015 - HBase at Factual: Real time and Batch Uses by Molly O'...Big Data Day LA 2015 - HBase at Factual: Real time and Batch Uses by Molly O'...
Big Data Day LA 2015 - HBase at Factual: Real time and Batch Uses by Molly O'...
 
IBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration Basics
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
 
in-memory database system and low latency
in-memory database system and low latencyin-memory database system and low latency
in-memory database system and low latency
 
MonetDB :column-store approach in database
MonetDB :column-store approach in databaseMonetDB :column-store approach in database
MonetDB :column-store approach in database
 
Four NoSQL Databases You Should Know
Four NoSQL Databases You Should KnowFour NoSQL Databases You Should Know
Four NoSQL Databases You Should Know
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
 
NoSQL - 05March2014 Seminar
NoSQL - 05March2014 SeminarNoSQL - 05March2014 Seminar
NoSQL - 05March2014 Seminar
 

En vedette (7)

Geek Sync | SQL Server Indexing Basics
Geek Sync | SQL Server Indexing BasicsGeek Sync | SQL Server Indexing Basics
Geek Sync | SQL Server Indexing Basics
 
Indexing basics
Indexing basicsIndexing basics
Indexing basics
 
Writing optimal queries
Writing optimal queriesWriting optimal queries
Writing optimal queries
 
Indexes
IndexesIndexes
Indexes
 
Database index
Database indexDatabase index
Database index
 
PostgreSQL: Advanced indexing
PostgreSQL: Advanced indexingPostgreSQL: Advanced indexing
PostgreSQL: Advanced indexing
 
Indexing
IndexingIndexing
Indexing
 

Similaire à Advanced Index, Partitioning and Compression Strategies for SQL Server

Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Charley Hanania
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
sqlserver.co.il
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
Alfredo Abate
 

Similaire à Advanced Index, Partitioning and Compression Strategies for SQL Server (20)

Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
Pass chapter meeting dec 2013 - compression a hidden gem for io heavy databas...
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
KoprowskiT_SQLSat409_MaintenancePlansForBeginners
KoprowskiT_SQLSat409_MaintenancePlansForBeginnersKoprowskiT_SQLSat409_MaintenancePlansForBeginners
KoprowskiT_SQLSat409_MaintenancePlansForBeginners
 
KoprowskiT_SQLSaturday409_MaintenancePlansForBeginners
KoprowskiT_SQLSaturday409_MaintenancePlansForBeginnersKoprowskiT_SQLSaturday409_MaintenancePlansForBeginners
KoprowskiT_SQLSaturday409_MaintenancePlansForBeginners
 
Apache CarbonData:New high performance data format for faster data analysis
Apache CarbonData:New high performance data format for faster data analysisApache CarbonData:New high performance data format for faster data analysis
Apache CarbonData:New high performance data format for faster data analysis
 
What's new in SQL Server 2016
What's new in SQL Server 2016What's new in SQL Server 2016
What's new in SQL Server 2016
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
 
How SQL Server 2016 SP1 Changes the Game
How SQL Server 2016 SP1 Changes the GameHow SQL Server 2016 SP1 Changes the Game
How SQL Server 2016 SP1 Changes the Game
 
Hp vertica certification guide
Hp vertica certification guideHp vertica certification guide
Hp vertica certification guide
 
Hpverticacertificationguide 150322232921-conversion-gate01
Hpverticacertificationguide 150322232921-conversion-gate01Hpverticacertificationguide 150322232921-conversion-gate01
Hpverticacertificationguide 150322232921-conversion-gate01
 
Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
 
Sap abap
Sap abapSap abap
Sap abap
 
Data warehousing guidelines for bi and BAM solutions
Data warehousing guidelines for bi and BAM solutionsData warehousing guidelines for bi and BAM solutions
Data warehousing guidelines for bi and BAM solutions
 
KoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginnersKoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginners
KoprowskiT_SQLRelay2014#2_Southampton_MaintenancePlansForBeginners
 
SQL Server 2008 Development for Programmers
SQL Server 2008 Development for ProgrammersSQL Server 2008 Development for Programmers
SQL Server 2008 Development for Programmers
 
Sql interview question part 10
Sql interview question part 10Sql interview question part 10
Sql interview question part 10
 
Ebook10
Ebook10Ebook10
Ebook10
 
Sql 2016 - What's New
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's New
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 

Advanced Index, Partitioning and Compression Strategies for SQL Server

  • 1. Advanced Index, Partitioning and Compression Strategies for SQL Server Neil Hambly Senior DBA & Engineer, Confio Software 8/16/2013 1
  • 2. Who Am I? • Senior DBA/Engineer for Confio Software – NeilHambly@confio.com {Based in the UK} • DBA – 14+ Years, SQL Server 6.5 - 2012 • Held # of DB roles @ many leading organizations • Regular International PASS Presenter @ SQL Conferences, User-Groups & Webinars • SQL London PASS Chapter Leader, UK Events Organizer • Regular @ UK & International community events • Twitter: @Neil_Hambly & @Confio Contributing Author • Articles @ Confio.com & My blog 8/16/2013 2
  • 3. Agenda • Talk about the two features – Compression & Partitioning • Using Data Compression in SQL Server 2005+ – Compression • Editions, Data types • Vardecimal Compression (2005 SP2) • Page | Row Compression (2008+) • Unicode Compression • Estimate space & resources – Partitioning – Combining with other features – Demos • Partition-Info Script • Finding objects for compression • Q&A + further links 8/16/2013 3
  • 4. Data Types 8/16/2013 4 Data Compression was introduced in SQL 2005 (SP2) via vardecimal storage This was superseded in SQL Server in 2008 Version (Row & Page level) Compression feature is only available in Enterprise and Developer SKU’s Note: NULL and 0 values across all data types are optimized to take 0 bytes in addition to 4 bits/per Column Data Type / Benefits with Data Compression Yes – depends on data No or little benefit (Normally) bit / smallint / int / bigint tinyint / uniqueidentifier decimal / numeric datetime / datetime2 / datetimeoffset smalldatetime / date / time char / nchar / nvarchar varchar / text / ntext / image binary / timestamp / Rowversion varbinary money / smallmoney float / real sql_variant / FileStream cursor / table / xml
  • 5. SQL Server 2005 SP2 (Vardecimal) The vardecimal works the same way as the varchar works for efficiently storing alphanumeric data. 8/16/2013 5 HOW TO TURN ON THE VARDECIMAL OPTION Step 1: exec sp_db_vardecimal_storage_format '<dbname>', 'ON' This option will enable the vardecimal storage on the specified database. Step 2: exec sp_tableoption '<table>', 'vardecimal storage format', 1 This option will turn on the vardecimal storage for the existing table. HOW TO ESTIMATE WHETHER IT IS WORTH TURNING ON THIS OPTION sys.sp_estimated_rowsize_reduction_for_vardecimal '<table>' Column precision Original fixed decimal size (bytes) Maximum vardecimal data area (bytes) Overhead to store offset (bytes) Maximum vardecimal storage used (bytes) 1-3 5 3 2 5 4-6 5 4 2 6 7-9 5 5 2 7 10-12 9 6 2 8 13-15 9 8 2 10 16-18 9 9 2 11 19 9 10 2 12 20-21 13 10 2 12 22-24 13 11 2 13 25-27 13 13 2 15 28 13 14 2 16 29-30 17 14 2 16 31-33 17 15 2 17 34-36 17 16 2 18 37-38 17 18 2 20
  • 6. Page & Row Level Compression 8/16/2013 6 Since 2008 version, we have new compression algorithms available Compressing the leaf level of tables and indexes with page compression consists of three operations, these are done in the following order: 1. Row compression 2. Prefix compression 3. Dictionary compression Note: When using page compression, the non–leaf-level pages of indexes are only row compressed Row Compression Prefix Compression Dictionary Compression
  • 7. Unicode Compression Space savings that can be achieved for different locales (15-50%) 8/16/2013 7 Standard Compression Scheme for Unicode (SCSU) SCSU algorithm to compress Unicode values that are stored in row or page compressed objects Unicode compression supports the fixed- length nchar(n) and nvarchar(n) data types. Data values that are stored off row or in nvarchar(max) columns are not compressed Locale Compression % English 50% German 50% Hindi 50% Turkish 48% Vietnamese 39% Japanese 15% SCSU can also switch to UTF-16 internally to handle non-alphabetic languages
  • 8. Supercharge SQL Server Performance with Indexing, Partitioning and Compression View this full 60-minute webinar, compliments of Confio Software, to supercharge SQL Server performance using advanced techniques for indexing, partitioning and/or compression. You’ll learn: • How to identify which objects will benefit the most from indexing • How to decide when you should combine indexing, partitioning and compression • How these techniques have been applied in real-world scenarios • How to you can use available demo scripts to determine which objects in your environment will benefit from these techniques www.confio.com 8/16/2013 8