THE SQL Server Blog Spot on the Web
Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

Paul Nielsen

www.SQLServerBible.com

Whole Database - Data Compression Procs

Data compression is one of my favorite new SQL Server 2008 features. For high-transaction databases, it can dramatically cut the I/O and make SAN shadow copy backups smaller.

As cool as data compression is,  enabling compression means running the compression wizard or alter table/index command for each individual object or index. The good news is that Microsoft has exposed the system stored procedure that estimates the potential gain using compression.

I’ve just posted on www.SQLServerBible.com a script that includes two stored procedures.

db_compression_estimate estimates the row and page compression gain for every object and index in the database.

db_compression (@minCompression) will check the current compression setting and compare it to potential row and page compression gains. If the compression should be adjusted it performs the alter command. The default @minCompression setting is 25%.

If the estimated gain is equal to or greater than @minCompression parameter then it enables row or page compression whichever is greater gain. If row and page have same gain then it enables row compression.

If estimated gain is less than @mincompression parameter then compression is set to none.

disclaimer: This is a first version of these stored procedures. This version has no error trapping. Also there’s a known issue when using Insert..exec with sp_estimate_data_compression_savings that generates a transaction error. The script was developed for CPT6. please email any issues to pauln@sqlserverbible.com. 

 


Published Thursday, March 13, 2008 2:36 PM by Paul Nielsen

Attachment(s): compression.jpg

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Josh Jones said:

Wow Paul, thanks. Can't wait to give these a spin.

March 14, 2008 12:04 AM
 

Christopher Steen said:

ASP.NET Attack and Defense: Securing ASP.NET 2.0 Apps [Via: Keith Brown ] WPF A WPF File Selection...

March 14, 2008 9:11 AM
 

Christopher Steen said:

Link Listing - March 13, 2008

March 14, 2008 9:11 AM
 

SQL Server e dintorni said:

Allo scorso workshop UGISS di Roma ( qui sono disponibili le slide e le demo) ho parlato, tra le altre

June 24, 2008 2:11 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

About Paul Nielsen

Paul Nielsen believes SQL is the romance language of data. As such he’s a hands-on database developer, Microsoft SQL Server MVP, trainer, and author of SQL Server Bible series (Wiley). As a data architect, he developed the concepts of Smart Database Design and Nordic – an open source O/R dbms for SQL Server. Paul supports the SQL community as a Director at Large for PASS (Professional Association for SQL Server). You may have seen Paul speaking at a PASS Summit, SQL Open in Denmark, or SQL Teach in Canada. He lives in Colorado Springs.
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement