All Products
Search
Document Center

ApsaraDB RDS:Parallel operations

Last Updated:Oct 13, 2023

Ganos uses multiple CPU cores to increase the performance of queries or computing. This mechanism is called parallel operation. Ganos supports the parallel execution of SQL statements and parallel operations on rasters.

Execute SQL statements in parallel

  • How it works

    PostgreSQL uses multiple CPU cores to generate multiple parallel query plans. Then, PostgreSQL balances the new query plans across these CPU cores. This increases the query performance.

  • Scenarios

    If you want to scan a large number of raster objects to identify the raster objects that meet the specified spatial scope or attribute requirements, we recommend that you execute SQL statements in parallel. This significantly reduces the time that is required to run queries.

  • Applicable scope

    All the read-only functions that are used to compute raster objects in Ganos support parallel queries. These functions include the function that is used to query the attributes of a raster object.

Manage raster objects in parallel

Before you start

  • Set the maximum number of transactions that can be used in the prepared state.

    You can use the max_prepared_transactions parameter to set the maximum number. The default value of this parameter is 0. We recommend that you set this parameter to the value of the max_connections parameter. This ensures that one transaction in the Prepared state is assigned to each connection.

    Note

    After you modify this parameter, you must restart your instance.

  • Set the degree of parallelism

    If you do not specify the degree of parallelism (DOP) or set the DOP to 0 for a function that supports parallel operations, the system automatically uses the value of the ganos.parallel.degree parameter as the DOP. The ganos.parallel.degree parameter is a Grand Unified Configuration (GUC) parameter. The default value of the ganos.parallel.degree parameter is 1. The default value indicates that parallel executions or operations are not supported.

    You can also set this parameter to a positive integer for a function that supports parallel raster-level operations. Then, you can split the computation on a raster object into parallel tasks. Example

    select ST_ImportFrom('chunk_table','OSS://<akxxxx>:<ak_secretxxxx>@oss-cn-beijing-internal.aliyuncs.com/mybucket/data/image.nc:hcc', '{}', '{"parallel": 4}');
  • Set the transactional consistency

    You can specify the transactional consistency by using the ganos.parallel.transaction GUC parameter. Valid values:

    • transaction_commit: Parallel transactions can be committed or rolled back based on the primary transaction. This is the default value.

    • fast_commit: Parallel transactions cannot be rolled back.

Note
  • To ensure the optimal performance, you can use the ST_CreateChunkTable function to create a chunk table in advance.

  • If a parallel function cannot return a temporary chunk table that is created by an anonymous user, you must first create a chunk table. Then, specify the chunk table in the chunktable parameter.