Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2008 Page/Row Compression Thoughts

Have other people here played with SQL Server 2008 Compression at either the page or the row level on their datasets much? What have your impressions been on performance both speed and disk-space wise?

Has anyone ever seen compression demonstrably hurt performance?

On some of our huge fact tables we've been playing around and noticing that compression can make a hugely beneficial query speed difference on both tables and its indexes. It's also been saving a lot of disk space (~50% on some data). Our hardware setup is severely disk/io bound relative to the processor and compression so far seems like a trivially easy performance win for us.

like image 550
Bob Albright Avatar asked May 08 '09 04:05

Bob Albright


People also ask

What is Page level compression in SQL Server?

Page-level compression compresses data by storing repeating values and common prefixes only once and then making references to those values from other locations within the table. When page compression is applied to a table, row compression techniques are also applied.

What is the difference between row and page compression in SQL Server?

In short though, page compression encompasses the algorithms contained with row level compression and then also covers Prefix compression and Dictionary compression. Prefix and dictionary compression finds patterns in the data and replaces them with smaller values.

Which compression saves more space page row?

Though Page Level compression is superior (save more space), compression depends on the type of data you stored in the table, data duplication and it's HEAP or non HEAP. Non HEAP table gives better compression. A table has three types of allocation unit IN_ROW_DATA, LOB_DATA and ROW_OVERFLOW_DATA.

Does SQL Server compress data?

There are three forms of data compression you can use with SQL Server: row-level compression, unicode compression, and page-level compression. To learn more about heaps, see Heaps (Tables without Clustered Indexes) in the MSDN library.


1 Answers

Old question, but from experience, a simple rule of thumb is:

  • for non-BLOB data row-store page compression ratio is between 3 and 4 times
  • for non-BLOB data column-store compression ratio is between 9 and 11 times

Linchi Shea articles seem to be behind a login now....

Linchi Shea has posted some interesting articles on this topic:

  • SQL Server 2008 Page Compression: Compression ratios with real-world databases

  • SQL Server 2008 Data Compression: Impact of Data Distribution

  • SQL Server 2008 Page Compression: Performance impact on table scans

  • SQL Server 2008 Page Compression: Performance impact on inserts

  • SQL Server 2008 Page Compression: Using multiple processors

This might also be of interest:

  • Best Practices for Data Warehousing with SQL Server 2008

The SQL Server Storage Engine blog also has a few interesting posts on Compression.

like image 192
Mitch Wheat Avatar answered Oct 27 '22 01:10

Mitch Wheat