All Products
Search
Document Center

PolarDB:Enable the storage compression feature

Last Updated:Nov 06, 2024

PolarDB supports the storage compression feature. After you enable the storage compression feature, user data is compressed by blocks at the storage layer based on a high compression ratio. This significantly reduces storage usage and 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 runs PolarDB for PostgreSQL Enterprise Edition.

  • Your cluster is of Cluster Edition and runs PolarDB for PostgreSQL 14 whose revision version is 2.0.14.18.2 or later.

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

Limits

  • You can enable the storage compression feature only for PolarDB clusters that use the PSL4 storage type.

  • The storage compression feature compresses data storage and does not compress log storage.

  • You cannot enable the storage compression feature for PolarDB clusters that contain ongoing data migration tasks.

Usage notes

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

  • After you enable the storage compression feature, you cannot disable it online.

  • After you enable the storage compression feature, the following rules apply to the free quota of level-1 backups. 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 based on the pay-as-you-go billing 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 based on the subscription billing 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 based on the subscription billing 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.

  • You cannot compress data that is encrypted by using transparent data encryption (TDE). If you compress TDE-encrypted data, the compression ratio is affected.

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. In the upper-right corner of the Distributed Storage section on the Basic Information page, click Enable Storage Compression. In the message that appears, click OK.

    After you perform the preceding operations, 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 perform the preceding operations, 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 the storage usage in the Distributed Storage section of the Basic Information page. The data size after compression is displayed in parentheses.

    image

Note

You are charged storage usage fees based on the size of physical data after compression. You can purchase storage plans to offset storage usage fees. For information about how to purchase a storage plan, see Purchase a storage plan.