SQL Server Compression Estimation
Presented by Warwick Rudd – [email protected]
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
Contents
• History of Compression• SQL Server Database Compression• SQL Server Backup Compression• Compression Estimation Tool
What is Compression ?
The reduction in size of data to save space or processing time.
History of Compression
• SQL Server 2005 SP2– New Data type - VarDecimal
• SQL Server 2008 – Database & Backup compression
• SQL Server 2008 R2– Unicode data compression
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
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
Database Compression Estimation
• SQL Server 2005 SP2– Sys.sp_estimated_rowsize_reduction_for_vardecimal
• SQL Server 2008 & R2– Sp_estimate_data_compression_savings
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
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
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
Things to consider
• Compression with partitions– Splitting a range– Merging a range– Switching partitions
SQL Server Database Compression Demo
Backup Compression MatrixSQL Server 2005 SP2
SQL Server 2008
SQL Server 2008 R2
EditionStandard Enterprise Datacenter
Backup Compression Cost Benefit Analysis
Benefits CostPerformance improvements Increased CPU utilisation
• Reduced I/O
Reduced disk space usage
Reduced time to backup
Cost Savings
Enabling Backup Compression
• Instance level– SSMS– Transact SQL
• Defaults can be overidden– Transaction Log Shipping– Maintenance Plans– SSMS– Transact SQL
SQL Server Backup Compression Demo
Compression Estimation Tool
• Available from Codeplex– http://ssce.codeplex.com/
Compression Estimation Tool Demo
Thanks for listening
[email protected] 144 302http://www.wardyit.comhttp://www.wardyit.com/blog
Other Resources
• http://blogs.msdn.com/b/sqlserverstorageengine/archive/tags/data+compression/
• http://msdn.microsoft.com/en-us/library/dd894051(v=sql.100).aspx#_Appendix_C:_Script
• http://msdn.microsoft.com/en-us/library/cc280576.aspx• http://msdn.microsoft.com/en-us/library/cc280464.aspx