All Products
Search
Document Center

PolarDB:How do I enable the storage compression feature?

Last Updated:Apr 15, 2024

PolarDB supports data compression at the storage layer. User data is compressed by blocks in the storage layer at a high compression ratio to reduce storage costs. This topic describes how to enable the storage compression feature and how to view the storage usage after you enable the feature.

Prerequisites

  • Your cluster is of PolarDB Enterprise Edition. For more information about how to view the cluster version, see Engine versions 5.6, 5.7, and 8.0.

  • Your cluster is of Cluster Edition and uses one of the following versions:

    • PolarDB for MySQL 5.6 whose revision version is 5.6.1.0.40.1 or later.

    • PolarDB for MySQL 5.7 whose revision version is 5.7.1.0.29.1 or later.

    • PolarDB for MySQL 8.0.1 whose revision version is 8.0.1.1.36.3 or later.

    • PolarDB for MySQL 8.0.2 whose revision version is 8.0.2.2.19 or later.

    • The storage type of your PolarDB cluster is PolarStore Level 4 (PSL4).

    • X-Engine is not enabled for your PolarDB cluster.

Limits

  • The storage compression feature can be enabled only for PolarDB clusters that use PSL4 storage type.

  • The storage compression feature cannot be enabled for PolarDB clusters that use the X-Engine.

  • After you enable the storage compression feature, only data storage is compressed, and log storage is not compressed.

  • The storage compression feature cannot be enabled for PolarDB clusters that are running data migration tasks.

Usage notes

  • Your business is not interrupted or affected when you enable the storage compression feature.

  • The following rules related to the free quota of level-1 backups are applicable after you enable the storage compression feature. For more information about the free quota of level-1 backups for a cluster, see Billing rules for backup storage that exceeds the free quota.

    • If the storage of the cluster is billed by using the pay-as-you-go method, the free quota of level-1 backups after you enable the storage compression feature is calculated by using the following formula: Storage usage of the database before compression × 50%.

    • If the storage of the cluster is billed by using the subscription method, the free quota of level-1 backups after you enable the storage compression feature is calculated by using the following formula: Max(Subscription-billed storage capacity, storage usage of the database before compression) × 50%.

      Example:

      The storage of a cluster is billed by using the subscription method, the subscription-billed storage capacity of the cluster is 2 TB, and the storage usage of the cluster is 1.6 TB. After you enable the storage compression feature, the storage usage of the cluster is compressed to 0.5 TB. In this case, you can manually reduce the subscription-billed storage capacity to 1 TB. For more information, see Manually scale storage capacity.

      The free quota of level-1 backups for the cluster is 0.8 TB. The value is calculated as follows: Max(1 TB, 1.6 TB) × 50% = 1.6 TB × 50% = 0.8 TB.

Procedure

  1. Log on to the PolarDB console.

  2. In the upper-left corner of the PolarDB console, select the region where the cluster is deployed.

  3. Find the cluster that you want to manage and click the cluster ID.

  4. On the Basic Information page, click Enable Storage Compression in the upper-right corner of the Distributed Storage section. In the message that appears, click OK.

    After you enable the storage compression feature, the cluster enters the Changing Configurations state. After the cluster returns to the Running state, the storage compression feature is enabled.

    image

  5. After you enable the storage compression feature, the cluster enters the Changing Configurations state. After the cluster returns to the Running state, the storage compression feature is enabled.

  6. After you enable the storage compression feature, you can check the changes in storage usage in the Distributed Storage section of the Basic Information page. The storage usage after compression is displayed as the physical data size on Elastic Block Storage (EBS).

    image

Note

You are charged fees based on the physical data size on EBS. You can purchase storage plans to offset storage fees for physical data on EBS. For more information, see Purchase a storage plan.