ApsaraDB RDS for PostgreSQL provides a pg_concurrency_control plug-in to control concurrency of SQL statements.
Prerequisites
Parameters
Parameter | Default value | Description |
---|---|---|
pg_concurrency_control.query_concurrency | 0 | Sets the maximum number of concurrent jobs in SELECT SQL statements. Valid values: 0 to 1024. Default value: 0. The default value indicates that concurrency control is disabled for SELECT SQL statements. |
pg_concurrency_control.bigquery_concurrency | 0 | Sets the maximum number of concurrent jobs in slow queries. Valid values: 0 to 1024.
Default value: 0. The default value indicates that concurrency control is disabled
for slow queries.
You can specify a statement as a slow query by using
The |
pg_concurrency_control.transaction_concurrency | 0 | Sets the maximum number of concurrent jobs for transaction blocks. Valid values: 0 to 1024. Default value: 0. The default value indicates that concurrency control is disabled for transaction blocks. |
pg_concurrency_control.autocommit_concurrency | 0 | Sets the maximum number of concurrent jobs in DML SQL statements. Valid values: 0 to 1024. Default value: 0. The default value indicates that concurrency control is disabled for DML SQL statements. |
pg_concurrency_control.control_timeout | 1s | Sets the maximum time to wait for a SELECT SQL statement, DML SQL statement, and transaction block. The minimum value is 30 ms, and the maximum value is 3s. |
pg_concurrency_control.bigsql_control_timeout | 1s | Sets the maximum time to wait for a slow query. The minimum value is 30 ms, and the maximum value is 3s. |
pg_concurrency_control.timeout_action | TCC_break | Sets the action upon a timeout for a SELECT SQL statement, DML SQL statement, and
transaction block. Valid values:
|
pg_concurrency_control.bigsql_timeout_action | TCC_wait | Sets the action upon a timeout for slow queries. Valid values:
|
Procedure
Example
Perform the following operations to enable concurrency control for custom SQL statements: