All Products
Search
Document Center

AnalyticDB for PostgreSQL:Change compute node configurations

Last Updated:Apr 11, 2024

As the data size and computing workload of AnalyticDB for PostgreSQL increase, the data processing speed may hit a bottleneck due to insufficient computing resources such as CPU, memory, disk storage, and compute nodes. In this case, you can change the compute node specifications and the number of compute nodes based on your business requirements.

The following table describes how configuration changes are supported for different resource types of AnalyticDB for PostgreSQL.

Operation

Serverless mode

Elastic storage mode

Upgrade node specifications

Unsupported

Supported

Downgrade node specifications

Unsupported

Supported

Add compute nodes

Supported

Supported

Remove compute nodes

Supported

Supported

Usage notes

  • To remove compute nodes from an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode, the minor version of the instance must be 6.3.10.5 or later. To remove compute nodes from an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode, the minor version of the instance must be V7.0.1.2 or later. For information about how to view the minor version of an instance, see View the minor engine version.

  • When you remove compute nodes from an AnalyticDB for PostgreSQL instance in elastic storage mode, data writes may be affected. When you add compute nodes to an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, data reads and writes are allowed. When you add compute nodes to instances of earlier versions, only data reads are allowed.

  • When you remove compute nodes from an instance in elastic storage mode, make sure that the instance capacity after scaling is sufficient to store the original instance data.

  • For instances in Serverless mode, the change to the number of compute nodes may cause the current SQL statements to be interrupted. These SQL statements cannot be resumed even after the change.

Amount of time required to change configurations

It takes about 10 minutes to upgrade or downgrade node specifications. The amount of time that is required to add or remove compute nodes varies based on the instance resource type.

  • Elastic storage mode

    The time required to change the number of compute nodes is approximately 30 minutes to dozens of hours. The exact amount of time depends on a variety of factors such as the number of tables, the number of partitions, the number of indexes, compression status, total data size, and instance specifications. After the change is completed and the instance status changes to running, you can access the instance.

    Note

    When you add compute nodes to an instance in elastic storage mode, take note of the following items:

    • For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is earlier than 6.6.2.0 or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is earlier than 7.0.5.0, tables that are in the redistributing state may fail to be written or temporarily fail to be read. You can try again later.

    • For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, data reads and writes are uninterrupted.

  • Serverless mode

    You can scale AnalyticDB for PostgreSQL instances in Serverless mode by changing the number of compute nodes within minutes without the need to migrate data. The scaling speed varies based on the amount of time that is required to apply for resources and is not affected by the data size. The following scaling performance is provided for reference:

    • An instance that has 16 or fewer compute nodes can be scaled within 60 seconds.

    • An instance that has more than 16 compute nodes can be scaled within 5 minutes.

Change compute node configurations

Add compute nodes

The elastic scaling feature ensures that your business runs normally and data reads and writes are uninterrupted on all tables in the database when you change compute node configurations. When you add compute nodes to an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, the elastic scaling feature is supported. Take note of the following items:

  • When you change compute node configurations, data redistribution is performed on all tables in sequence. Tables not in the redistributing state are not affected. Tables in the redistributing state support all query operations and the INSERT, COPY, DELETE, and UPDATE statements, but do not support DDL statements and VACUUM statements. When you execute a DDL statement such as TRUNCATE TABLE, an error is returned, as shown in the following code:

  • TRUNCATE t1;
    ERROR:  Unsupport 'TRUNCATE TABLE' command during online expansion on 't1'
  • If a large amount of data is written or updated, an extended period of time is required to change compute node configurations. If data is frequently written to specific tables, a write lock is added to the tables to speed up the change of compute node configurations. When you add compute nodes to an AnalyticDB for PostgreSQL instance in elastic storage mode that supports the elastic scaling feature, you can view the scaling progress in the AnalyticDB for PostgreSQL console.

Note

When you add compute nodes to instances of earlier versions, the elastic scaling feature is not supported. This may interrupt the reads and writes of tables. We recommend that you perform this operation during off-peak hours.

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Add Compute Node in the Actions column.

  4. In the Info dialog box, select I am aware of the impact of this operation and agree to continue it. and click OK.

    Note

    This step is available only for instances in Serverless mode.

  5. On the Upgrade/Downgrade page, select a value for the Nodes parameter based on your business requirements, read and select the Terms of Service, and then click Buy Now.

    Warning
    • For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is earlier than 6.6.2.0 or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is earlier than 7.0.5.0, tables that are in the redistributing state can only be read when you change the number of compute nodes. For an AnalyticDB for PostgreSQL V6.0 instance in elastic storage mode whose minor version is 6.6.2.0 or later or an AnalyticDB for PostgreSQL V7.0 instance in elastic storage mode whose minor version is 7.0.5.0 or later, tables that are in the redistributing state can be both read and written when you change the number of compute nodes. The amount of time that is required to redistribute data varies based on the table size. Perform this operation during an appropriate period of time.

    • For instances in Serverless mode, after you submit a request to change the number of compute nodes, the current SQL statements are interrupted. These SQL statements cannot be resumed even after the change.

  6. Return to the Instances page and wait for the instance to enter the Running state.

  7. You can execute the following SQL statement to prefetch data from tables that have high performance requirements to accelerate data access.

    SELECT count(*) FROM <hot_table>;
    Note
    • Data prefetching is required only for instances in Serverless mode.

    • When you change the number of compute nodes, the following operations are performed: The resources are initialized, the metadata about system tables is synchronized, the resources are locked to modify the data distribution information, the resources are unlocked and cleared, and the local cache is asynchronously restored. The hit ratio of the local cache remains low for a short period of time because the local cache is asynchronously restored. You can prefetch data to accelerate data access.

Remove compute nodes

Warning

When you remove compute nodes from an instance in elastic storage mode, make sure that the instance capacity after scaling is sufficient to store the original instance data. During the scaling period, we recommend that you do not perform update or write operations on the instance.

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Remove Compute Node in the Actions column.

  4. In the Info dialog box, select I am aware of the impact of this operation and agree to continue it. and click OK.

  5. On the Upgrade/Downgrade page, select a value for the Nodes parameter based on your business requirements, read and select the Terms of Service, and then click Buy Now.

    Warning
    • For instances in elastic storage mode, tables that are in the redistributing state can only be read when you change the number of compute nodes. The amount of time that is required to redistribute data varies based on the table size. Perform this operation during an appropriate period of time.

    • For instances in Serverless mode, after you submit a request to change the number of compute nodes, the current SQL statements are interrupted. These SQL statements cannot be resumed even after the change.

  6. Return to the Instances page and wait for the instance to enter the Running state.

  7. You can execute the following SQL statement to prefetch data from tables that have high performance requirements to accelerate data access.

Upgrade node specifications

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Upgrade Node Specifications in the Actions column.

  4. On the Upgrade/Downgrade page, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Instance Resource Type

    The resource type of the current instance is displayed and cannot be modified.

    Compute Node Specifications

    Select node specifications based on your business requirements.

    Single Node Storage Capacity

    Select a storage capacity per node based on your business requirements.

    Warning
    • Data can only be read when you change the node specifications. Perform this operation during an appropriate period of time.

    • Data reads and writes are not affected when you change the storage capacity.

  5. Read and select the Terms of Service, and then click Buy Now.

  6. Return to the Instances page and wait for the instance to enter the Running state.

Downgrade node specifications

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and choose Change Compute Node Configurations > Downgrade Node Specifications in the Actions column.

  4. On the Downgrade page, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Instance Resource Type

    The resource type of the current instance is displayed and cannot be modified.

    Compute Node Specifications

    Select node specifications based on your business requirements.

    Single Node Storage Capacity

    The storage capacity per node cannot be downgraded.

    Note

    This parameter is unavailable for Basic Edition instances in elastic storage mode.

    Warning
    • Data can only be read when you change the node specifications. Perform this operation during an appropriate period of time.

    • Data reads and writes are not affected when you change the storage capacity.

  5. Read and select the Terms of Service, and then click Buy Now.

  6. Return to the Instances page and wait for the instance to enter the Running state.

References

Instance specifications