Updated on 2026-01-06 GMT+08:00

Asynchronous I/O Flow Control

The asynchronous I/O flow control is supported only by clusters of version 9.1.1.200 or later.

obs_add_limit_config(access_key, bucket, metric, speed_ratio, expires_s)

Description: Limits OBS requests by adding flow control configuration items in a storage-compute decoupling design to lower OBS metrics.

The following table describes the input parameters of the function.

Column

Type

Description

access_key

text

Key for OBS access. Ensure the related OBS settings exist in either the PG_TABLESPACE or PG_FOREIGN_SERVER.

bucket

text

OBS bucket to be accessed. If it is an empty string, the entire OBS tenant is restricted.

metric

text

Restricted metrics, including conn, read_tps, write_tps, list_tps, total_tps, read_bps, write_bps, and total_bps.

speed_ratio

bigint

Rate limit ratio. The value ranges from 1 to 100. The default value is 80. The value 100 indicates that the rate is not limited.

expires_s

bigint

Validity period of the rate limit. The value ranges from 1 to 3600, in seconds. The default value is 60.

Return type: record

The following table describes return columns.

Column

Type

Description

nodename

text

Name of the node where the statement is executed.

result

boolean

Check whether the flow control configuration item is added.

  • t: The item is added.
  • f: The item fails to be added.

Examples:

Adding a flow control configuration item to limit OBS requests.

Use your access key (replace XXXXXXXXXXXXX) to connect to the test OBS bucket. Restrict the conn metric with a rate limit of 80% for 100 seconds. Replace them with the actual values as needed.

1
2
3
4
5
6
SELECT * FROM obs_add_limit_config('XXXXXXXXXXXXX','test','conn','80','100');
   nodename   | result 
--------------+--------
 coordinator1 | t
(1 row)
-- 

If the expires_s parameter is not specified, the validity period of the rate limit is 60 seconds by default.

1
2
3
4
5
SELECT * FROM obs_add_limit_config('XXXXXXXXXXXXX','test','conn','80');
   nodename   | result 
--------------+--------
 coordinator1 | t
(1 row)

By default, speed_ratio is set to 80, and expires_s is set to 60 (in seconds).

1
2
3
4
5
SELECT * FROM obs_add_limit_config('XXXXXXXXXXXXX','test','conn');
   nodename   | result 
--------------+--------
 coordinator1 | t
(1 row)

obs_delete_limit_config(access_key, bucket, metric)

Description: Deletes an OBS flow control configuration item from the current node.

The following table describes the input parameters of the function.

Column

Type

Description

access_key

text

Access key of the existing flow control configuration item.

bucket

text

OBS bucket name of existing flow control configuration item.

metric

text

Metric of existing flow control configuration item.

Return type: record

The following table describes return columns.

Column

Type

Description

nodename

text

Name of the node where the statement is executed.

result

boolean

Check whether the OBS flow control configuration item is deleted.

  • t: The item is deleted.
  • f: The item fails to be deleted.

Example:

Delete an OBS flow control configuration item from the current node.

Use your access key (replace XXXXXXXXXXXXX) to connect to the test OBS bucket. Restrict the conn metric. Replace them with the actual values as needed.

1
2
3
4
5
SELECT * FROM obs_delete_limit_config('XXXXXXXXXXXXX','test','conn');
   nodename   | result 
--------------+--------
 coordinator1 | t
(1 row)

obs_clear_limit_configs()

Description: Clears all OBS flow control configuration items from the current node.

Return type: record

The following table describes return columns.

Column

Type

Description

nodename

text

Name of the node where the statement is executed.

result

boolean

Check whether the flow control configuration items are cleared.

  • t: The items are deleted.
  • f: The items fail to be deleted.

Example:

Clear all OBS flow control configuration items from the current node.

1
2
3
4
5
SELECT * FROM obs_clear_limit_configs();
   nodename   | result 
--------------+--------
 coordinator1 | t
(1 row)

obs_query_limit_configs()

Description: Queries all OBS flow control configuration items from the current node.

Return type: record

The following table describes return columns.

Column

Type

Description

nodename

text

Name of the node where the statement is executed.

access_key

bool

Access key of the existing flow control configuration item.

bucket

text

OBS bucket name.

metric

text

Restricted metric.

speed_ratio

bigint

Rate limit ratio.

expires_s

bigint

Validity period of the rate limit configuration item.

is_expired

boolean

Whether the rate limit configuration item has expired.

  • t: expired
  • f: not expired

expiration_time

timestamp

Expiration time of the rate limit.

create_time

timestamp

Time when the rate limit configuration item is added for the first time.

update_time

timestamp

Time when the rate limit configuration item is updated. If a rate limit configuration item already exists, you can use this parameter to update the item.

Example:

Query all OBS flow control configuration items from the current node.

Use the OBS bucket test, restrict the conn metric, use an 80% rate limit for 100 seconds. The current configuration has expired. It was initially executed on October 11, 2025, at 09:09:43+08.

1
2
3
4
SELECT * FROM obs_query_limit_configs();
   nodename   |      access_key      | bucket | metric | speed_ratio | expires_s | is_expired |    expiration_time     |      create_time       |      update_time       
--------------+----------------------+--------+--------+-------------+-----------+------------+------------------------+------------------------+------------------------
 coordinator1 | xxxxxxxxxxxxxxxxxxxxx|  test  | conn   |          80 |       100 | t          | 2025-10-11 09:11:23+08 | 2025-10-11 09:09:43+08 | 2025-10-11 09:09:43+08

pgxc_obs_add_limit_config(target, access_key, bucket, metric, speed_ratio, expires_s)

Description: Limits OBS requests by adding flow control configuration items in a storage-compute decoupling design to lower OBS metrics.

The following table describes the input parameters of the function.

Column

Type

Description

target

text

Target nodes. The default value is all. Values:
  • all: indicates all nodes.
  • cn: indicates all CN nodes.
  • coordinator: indicates all CN nodes.
  • dn: indicates all DNs.
  • datanode: indicates all DNs.

access_key

text

Key for OBS access. Ensure the related OBS settings exist in either the PG_TABLESPACE or PG_FOREIGN_SERVER.

bucket

text

OBS bucket to be accessed. If it is an empty string, the entire OBS tenant is restricted.

metric

text

Restricted metrics, including conn, read_tps, write_tps, list_tps, total_tps, read_bps, write_bps, and total_bps.

speed_ratio

bigint

Rate limit ratio. The value ranges from 1 to 100. The default value is 80.

expires_s

bigint

Validity period of the rate limit. The value ranges from 1 to 3600, in seconds. The default value is 60.

Return type: record

The following table describes return columns.

Column

Type

Description

total_instances

int

Total number of nodes which configuration items need to be added to.

success_instances

int

Number of nodes which configuration items are added to.

failed_instances

int

Number of nodes which configuration items fails to be added to.

failed_nodes

text

Information about the nodes which configuration items fails to be added to.

Example:

1
2
3
4
5
SELECT * FROM pgxc_obs_add_limit_config('all','XXXXXXXXXXXX','test','conn', 70, 1200);
 total_instances | success_instances | failed_instances | failed_nodes 
-----------------+-------------------+------------------+--------------
               4 |                 4 |                0 | 
(1 row)

If the expires_s parameter is not specified, the validity period of the rate limit is 60 seconds by default.

1
2
3
4
5
select * from pgxc_obs_add_limit_config('all','XXXXXXXXXXXX','test','conn', 70);
 total_instances | success_instances | failed_instances | failed_nodes 
-----------------+-------------------+------------------+--------------
               4 |                 4 |                0 | 
(1 row)

By default, speed_ratio is set to 80, and expires_s is set to 60 (in seconds).

1
2
3
4
5
SELECT * FROM pgxc_obs_add_limit_config('all','XXXXXXXXXXXX','test','conn');
 total_instances | success_instances | failed_instances | failed_nodes 
-----------------+-------------------+------------------+--------------
               4 |                 4 |                0 | 
(1 row)

pgxc_obs_delete_limit_config(target,access_key, bucket, metric)

Description: Deletes flow control configuration items on target nodes in batches.

The following table describes the input parameters of the function.

Column

Type

Description

target

text

Target nodes. The default value is all. Values:
  • all: indicates all nodes.
  • cn: indicates all CN nodes.
  • coordinator: indicates all CN nodes.
  • dn: indicates all DNs.
  • datanode: indicates all DNs.

access_key

text

Access key of the existing flow control configuration item.

bucket

text

Bucket of the existing flow control configuration item.

metric

text

Metric of existing flow control configuration item.

Return type: record

The following table describes return columns.

Column

Type

Description

total_instances

int

Total number of nodes which configuration items need to be deleted from.

success_instances

int

Number of nodes which configuration items are deleted from.

failed_instances

int

Number of nodes which configuration items fail to be deleted from.

failed_nodes

text

Information about the nodes which configuration items fail to be deleted from.

Example:

1
2
3
4
5
SELECT * FROM pgxc_obs_delete_limit_config('all','XXXXXXXXXXXX','test','conn');
 total_instances | success_instances | failed_instances | failed_nodes 
-----------------+-------------------+------------------+--------------
               4 |                 4 |                0 | 
(1 row)

pgxc_obs_clear_limit_configs(target)

Description: Clears all OBS flow control configuration items on target nodes in batches.

Input parameter target: target nodes. The parameter type is text and the default value is all. Values:

  • all: indicates all nodes.
  • cn: indicates all CN nodes.
  • coordinator: indicates all CN nodes.
  • dn: indicates all DNs.
  • datanode: indicates all DNs.

Return type: record

The following table describes return columns.

Column

Type

Description

total_instances

int

Total number of nodes which configuration items need to be cleared from.

success_instances

int

Number of nodes which configuration items are cleared from.

failed_instances

int

Number of nodes which configuration items fail to be cleared from.

failed_nodes

text

Information about the nodes which configuration items fail to be cleared from.

Example:

Clear the OBS flow control configuration items on all nodes.

1
2
3
4
5
SELECT * FROM pgxc_obs_clear_limit_configs('all');
 total_instances | success_instances | failed_instances | failed_nodes 
-----------------+-------------------+------------------+--------------
               4 |                 4 |                0 | 
(1 row)

If the target parameter is not specified, the OBS flow control configuration items on all nodes are cleared by default.

1
2
3
4
5
SELECT * FROM pgxc_obs_clear_limit_configs();
 total_instances | success_instances | failed_instances | failed_nodes 
-----------------+-------------------+------------------+--------------
               4 |                 4 |                0 | 
(1 row)

pgxc_obs_query_limit_configs(target)

Description: Queries all flow control configuration items on the target nodes.

Input parameter target: target nodes. The parameter type is text and the default value is all. Values:

  • all: indicates all nodes.
  • cn: indicates all CN nodes.
  • coordinator: indicates all CN nodes.
  • dn: indicates all DNs.
  • datanode: indicates all DNs.

Return type: record

The following table describes return columns.

Column

Type

Description

nodename

text

Name of the node where the statement is executed.

access_key

bool

Check whether the flow control configuration item is deleted.

  • t: The item is deleted.
  • f: The item fails to be deleted.

bucket

text

OBS bucket name.

metric

text

Restricted metric.

speed_ratio

bigint

Rate limit ratio.

expires_s

bigint

Validity period of the rate limit configuration item.

is_expired

boolean

Whether the rate limit configuration item has expired.

  • t: expired
  • f: not expired

expiration_time

timestamp

Expiration time of the rate limit.

create_time

timestamp

Time when the rate limit configuration item is added for the first time.

update_time

timestamp

Time when the rate limit configuration item is updated. If a rate limit configuration item already exists, you can use this parameter to update it.

Example:

Query all flow control configuration items on all nodes.

1
2
3
4
5
6
7
8
SELECT * FROM pgxc_obs_query_limit_configs('all');
   nodename   |      access_key      |     bucket     | metric | speed_ratio | expires_s | is_expired |    expiration_time     |      create_time       |      update_time       
--------------+----------------------+----------------+--------+-------------+-----------+------------+------------------------+------------------------+------------------------
 datanode3    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 datanode2    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 datanode1    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 coordinator1 | XXXXXXXXXXXXX        | test          t| conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
(4 rows)

If the input parameter target is not specified, all flow control configuration items on all nodes are queried using the default value.

1
2
3
4
5
6
7
8
SELECT * FROM pgxc_obs_query_limit_configs();
   nodename   |      access_key      |     bucket     | metric | speed_ratio | expires_s | is_expired |    expiration_time     |      create_time       |      update_time       
--------------+----------------------+----------------+--------+-------------+-----------+------------+------------------------+------------------------+------------------------
 datanode3    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 datanode2    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 datanode1    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 coordinator1 | XXXXXXXXXXXXX        | test          t| conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
(4 rows)

Query all flow control configuration items on all DNs.

1
2
3
4
5
6
7
SELECT * FROM pgxc_obs_query_limit_configs('dn');
   nodename   |      access_key      |     bucket     | metric | speed_ratio | expires_s | is_expired |    expiration_time     |      create_time       |      update_time       
--------------+----------------------+----------------+--------+-------------+-----------+------------+------------------------+------------------------+------------------------
 datanode3    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 datanode2    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
 datanode1    | XXXXXXXXXXXXX        | test           | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
(3 rows)

Query all flow control configuration items on all CNs.

1
2
3
4
5
SELECT * FROM pgxc_obs_query_limit_configs('cn');
   nodename   |      access_key      |     bucket     | metric | speed_ratio | expires_s | is_expired |    expiration_time     |      create_time       |      update_time       
--------------+----------------------+----------------+--------+-------------+-----------+------------+------------------------+------------------------+------------------------
 coordinator1 | XXXXXXXXXXXXX        | test          t | conn   |          70 |      1200 | f          | 2025-10-11 10:07:37+08 | 2025-10-11 09:47:37+08 | 2025-10-11 09:47:37+08
(1 rows)