Configure parallel query
Single-table aggregate queries on large datasets can take seconds or longer. AnalyticDB for PostgreSQL automatically parallelizes these queries across CPU cores, reducing query time by about 50% in low-concurrency scenarios.
How it works
When your instance uses compute nodes with 4 or more cores, parallel query is enabled by default for individual table queries. The system selects the degree of parallelism automatically based on three factors: the number of concurrent queries, the compute node specifications, and the SQL statement being executed. Under high workload, the system disables parallel query to preserve overall throughput.
Parallel query applies to single-table queries only.
Requirements
Parallel query is supported on instances that meet all of the following conditions:
| Requirement | Details |
|---|---|
| Compute node specifications | 4 cores or higher (4C and above) |
| Minor engine version | 6.3.4.0 or later |
To update the minor engine version, see Update the minor engine version.
Example
The following example uses an instance with these specifications:
| Specification | Value |
|---|---|
| Compute node specifications | 4C32G |
| Number of compute nodes | 4 |
| Data volume tested | 10 GB |
Query times for the 10 GB single-table dataset, before and after parallel query:
| Before parallel query | After parallel query |
|---|---|
| 17456.066 ms | 9407.291 ms |