SQL Server Compression Estimation Presented by Warwick Rudd – [email protected].

21
SQL Server Compression Estimation Presented by Warwick Rudd – [email protected]

Transcript of SQL Server Compression Estimation Presented by Warwick Rudd – [email protected].

Page 1: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

SQL Server Compression Estimation

Presented by Warwick Rudd – [email protected]

Page 2: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

About Warwick Rudd

• SQL Server Consultant WARDY IT Solutions – Email: [email protected]

• Microsoft Certified IT Professional – SQL 2008 Admin (MCITP SQL 2008 Admin)

• Microsoft Certified Trainer (MCT)• WARDY IT Solutions

– Australia’s leading SQL Server specialists– Deloitte Technology Fast 500 Asia Pacific 2010 Winner

Page 3: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Contents

• History of Compression• SQL Server Database Compression• SQL Server Backup Compression• Compression Estimation Tool

Page 4: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

What is Compression ?

The reduction in size of data to save space or processing time.

Page 5: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

History of Compression

• SQL Server 2005 SP2– New Data type - VarDecimal

• SQL Server 2008 – Database & Backup compression

• SQL Server 2008 R2– Unicode data compression

Page 6: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Database Compression MatrixSQL Server 2005 SP2

SQL Server 2008

SQL Server 2008 R2

Edition Enterprise Enterprise Enterprise & Data Center

Compression Type

VarDecimal Row Level Page Level Unicode

Page 7: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Database Compression Cost Benefit Analysis

Benefits CostPerformance improvements Increased CPU utilisation

• More data in memory

• Reduced I/O

Reduced disk space usage

• Database data files

• Backup files

Reduced time to backup

Cost Savings

Page 8: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Database Compression Estimation

• SQL Server 2005 SP2– Sys.sp_estimated_rowsize_reduction_for_vardecimal

• SQL Server 2008 & R2– Sp_estimate_data_compression_savings

Page 9: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Enabling Database Compression

• SQL Server 2005 SP2– Enable database for Vardecimal Storage format

• Sp_db_vardecimal_storage_format

– Enabling table for Vardecimal Storage format• Sp_tableoption

• SQL Server 2008 & R2– Alter Table [TableName] Rebuild with (Data_compression =

Compression Type)• Compression Types

– Row– Page– None

Page 10: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Enabling Database Compression

– Alter Table [TableName] Rebuild Partition = All with (Data_compression = Compression Type on Partitions (x to n))

• Compression Types– Row– Page– None

– Alter Index [IndexName] on [TableName] Rebuild with (Data_compression = Compression Type)

• Compression Types– Row– Page– None

Page 11: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Things to consider

• Data types not able to be compressed– XML– BLOB– MAX Datatypes

• Tables not eligible for compression– Maximum row size + compression overhead >

8060 bytes

Page 12: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Things to consider

• Compression with partitions– Splitting a range– Merging a range– Switching partitions

Page 13: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

SQL Server Database Compression Demo

Page 14: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Backup Compression MatrixSQL Server 2005 SP2

SQL Server 2008

SQL Server 2008 R2

EditionStandard Enterprise Datacenter

Page 15: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Backup Compression Cost Benefit Analysis

Benefits CostPerformance improvements Increased CPU utilisation

• Reduced I/O

Reduced disk space usage

Reduced time to backup

Cost Savings

Page 16: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Enabling Backup Compression

• Instance level– SSMS– Transact SQL

• Defaults can be overidden– Transaction Log Shipping– Maintenance Plans– SSMS– Transact SQL

Page 17: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

SQL Server Backup Compression Demo

Page 18: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Compression Estimation Tool

• Available from Codeplex– http://ssce.codeplex.com/

Page 19: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Compression Estimation Tool Demo

Page 20: SQL Server Compression Estimation Presented by Warwick Rudd – warwick.rudd@wardyit.com.

Thanks for listening

[email protected] 144 302http://www.wardyit.comhttp://www.wardyit.com/blog