Skip to main content

DB2 data compression and storage optimization

Deep compression for lower data storage costs

Introducing DB2 10 for Linux, Unix and Windows. Explore the possibilities.

The DB2 Storage Optimization feature gives you the ability to transparently compress data on disk in order to decrease disk space and storage infrastructure requirements. Since disk storage systems can often be the most expensive components of a database solution, even a small reduction in the storage subsystem can result in substantial cost savings for the entire database solution.

Row Compression

When you have large amounts of data, the cost of the storage subsystem can easily exceed the cost of your data server. DB2 uses a variant of the Lempel-Ziv algorithm to apply compression to each row of a table. Log records are also compressed. Savings are extended to backup disk space, racks, cables, floor space, and other disk sub-system peripherals.

Because compressed rows are smaller, not only do you need fewer disks, but your overall system performance may be improved. Accessing data from the disk is the slowest database operation. By storing compressed data on disk, fewer I/O operations need to be performed to retrieve or store the same amount of data. Therefore, for disk I/O-bound workloads, the query processing time can be noticeably improved.

Since DB2 keeps the data compressed on both disk and memory, thereby reducing the amount of memory consumed, and freeing it up for other database or system operations. This can further improve database performance for queries and other operations.

Adaptive Row Compression

DB2 further enhances classical row compression through the use of adaptive row compression. By applying an advanced row compression technique that uses two levels of compression dictionaries—table-level and page-level—DB2 can reach higher compression ratios than ever before, and maintain them over time without table reorganization. As a result, it enables more granular, adaptive and dynamic updates, enhances query performance, and improves data availability.

Value Compression

Enabling value compression optimizes disk storage for NULL values, zero length data in variable length columns and system default values.

XML Compression

The verbose nature of XML implies that XML fragments and documents typically consume a lot of disk space. DB2 stores XML data in a parsed hierarchical format, replacing tag names (for example, employee) with integer shorthand. Repeated occurrences of the same tags are assigned the same shorthand. Storing text-rich tags using integer shorthand not only reduces space consumption but also assists with higher performance when querying data. Moreover, the XML tag parsing, like data row compression, is done under the covers and is completely transparent to users and applications.

Index Compression

DB2 uses a unique combination of data compression techniques to deliver superior storage savings when compressing database indexes. Also, the more efficient storage of database indexes often results in improved query performance.

Temporary Table Compression

Certain environments have significant storage requirements for temporary database tables. DB2 can compress both system temporary tables and user temporary tables, significantly reducing your storage needs for temporary tables.

Backup Compression

The compression of data on backup systems allows for smaller backup images that not only reduce backup storage requirements, but also make it easier to move backup images between systems. Savings can be extended to racks, cables, floor space, and other disk sub-system peripherals.