DB2 Row Compression Strategies
By Tom Nonmacher
Managing the size of your databases is a critical aspect of database management. One of the strategies that you can employ to achieve this is row compression. In today's blog post, we'll look at how you can implement row compression strategies in DB2 11.1, and compare this with the similar features available in SQL Server 2016, SQL Server 2017, MySQL 5.7, and Azure SQL.
Row compression in DB2 11.1 works by reducing the amount of physical storage required to store data. It works by using a technique known as value compression, which minimizes the space required to store NULL and default values. For example, you can use the following command to enable row compression:
ALTER TABLE table_name ROW COMPRESSION COMPRESS YES;
Remember to run the REORG command after altering the table. This command removes fragmented free space in the table, making the data storage more efficient. It is also important to note that the actual space savings from row compression will depend on the nature of your data, and the ratio of NULL and default values present.
SQL Server 2016 and 2017 also provide a similar feature known as data compression that can help reduce the size of your databases. You can use the following command to enable row compression:
ALTER TABLE table_name REBUILD WITH (DATA_COMPRESSION = ROW);
SQL Server's data compression feature also supports page compression, which is a more advanced form of compression that can provide even greater space savings. However, it requires more CPU resources, so you need to balance the need for space savings with the available CPU resources.
MySQL 5.7, on the other hand, does not have a built-in row compression feature. However, you can use third-party storage engines such as InnoDB, which supports a form of row compression known as compact row format. You can enable it using the following command:
ALTER TABLE table_name ROW_FORMAT=COMPACT;
Azure SQL, being a cloud-based database service, provides a feature known as Azure Data Compression. This feature allows you to compress data at the row level, page level, or column level, depending on your needs. You can enable row compression using the following command:
ALTER TABLE table_name REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = ROW);
In conclusion, row compression is a valuable tool for managing the size of your databases. It can not only help save storage space but also improve the performance of your database operations by reducing the amount of I/O required to retrieve data. However, the actual benefits will depend on the nature of your data and the specific database technology you are using.
Check out the latest articles from all our sites:
- How to Take Advantage of Flash Sales at Grocery Stores [https://www.ethrift.net]
- A brief history of the Galveston Hurricane of 1900 [https://www.galvestonbeachy.com]
- How to Plant and Maintain Chokeberry Bushes [https://www.gardenhomes.org]
- New Query Store Enhancements in SQL Server 2022 [https://www.sqlsupport.org]
- Heat: Why My Laptop Is Cooking My Lap [https://www.SupportMyPC.com]
- The Best Months to Visit South Korea for Cherry Blossoms and Fall Colors [https://www.treasureholidays.com]
Privacy Policy for sqlsupport.org
Last updated: Feb 03, 2026
sqlsupport.org respects your privacy and is committed to protecting any personal information you may provide while using this website.
This Privacy Policy document outlines the types of information that are collected and recorded by sqlsupport.org and how we use it.
Information We Collect
- Internet Protocol (IP) addresses
- Browser type and version
- Pages visited
- Time and date of visits
- Referring URLs
- Device type
Cookies and Web Beacons
sqlsupport.org uses cookies to store information about visitors preferences and to optimize the users experience.
How We Use Your Information
- Operate and maintain our website
- Improve user experience
- Analyze traffic patterns
- Prevent fraudulent activity
Contact
Email: admin@sqlsupport.org