Categories
DBA

Data Compression

Data compression is an enhanced feature available in SQL Server 2008. Database compression in SQL Server is introduced with SQL Server 2005 SP2 onwards where we have the capability to compress VARDECIMAL data type. This compression works when the actual value is less than the declared value, all the remaining values will be removed there by compressing the empty space. In SQL Server 2008 we have native compression techniques added to reduce the size of your database.

Editions Supporting Compression

  • SQL Server 2008 Enterprise
  • SQL Server 2008 Developer

In this article we are going to focus on need of compression and overview of compression enhancement.

Why we require compression in SQL Server?

Cost spent to Disk Space

This is one of the main focus for compressing the data in SQL Server. When you compress your data the amount of storage space required will get reduced there by reducing money spent on storage devices. You folks can think that in current market trend the prices are reduced however when you go for server environment we will be focusing on SAN disks and not the regular disks, so the cost is high for these type of disks. In addition to this your database backup size is also reduced to a greater extent hence again space used will be reduced for backups.

data_compression_part1_1

Low Disk IO

When your data storage size is reduced obviously there will be a great decrease in disk IO. After the compression you will be reading writing a small set of data size there by reducing the disk IO.

data_compression_part1_2

Easier to maintain compressed database

This is nothing but your maintenance plan. Lets say your rebuild or reorganize will take more time based on the size of your table, in this case the time taken will be reduced.

BEFORE Compression
==================
SQL Server Execution Times:
CPU time = 1904 ms, elapsed time = 4323 ms.

AFTER Compression
==================
SQL Server Execution Times:
CPU time = 6880 ms, elapsed time = 3663 ms.

Save cost spent on Memory

When you retrieve the compressed data it will be stored in buffer manager in compressed state only hence the size of physical memory required will be reduced. Obviously if you require less physical memory then you dont need to spend money in RAM for your server.

Works better than NTFS compression

NTFS compression considers database physical files as just files. There is no way to compress particular database table using NTFS compression.

Overview of Compression Technique Enhancement in SQL Server

I think no explanation is needed, the image will give you an clear idea on compression technique enhancement in SQL Server family.

data_compression_part1_3

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*