Parallel operations

更新时间:
复制 MD 格式

GanosBase uses multiple CPU cores to accelerate queries and computations on raster data through parallel operations. Two types of parallelism are supported:

  • Parallel SQL statements: The database distributes query execution across multiple CPU cores to scan and filter raster objects faster.

  • Parallel raster-level operations: GanosBase splits a single large raster object into subsets and processes them simultaneously across multiple CPU cores.

Use SQL-level parallelism to query or scan large numbers of raster objects. Use raster-level parallelism to process a single large raster object whose computation is time-consuming.

Prerequisites

Before you begin, configure the following parameters:

Parameter

Description

Default value

Recommended value

max_prepared_transactions

Maximum number of transactions that can be in the prepared state simultaneously.

0

Set to the value of max_connections

ganos.parallel.degree

Default degree of parallelism (DOP). A value of 1 disables parallel execution.

1

A positive integer based on your workload

ganos.parallel.transaction

Transactional consistency mode for parallel operations.

transaction_commit

Based on your consistency requirements

Important

After you modify max_prepared_transactions, you must restart your instance for the change to take effect.

max_prepared_transactions

Set max_prepared_transactions to the value of max_connections. This ensures one prepared-state transaction slot per connection. The default value is 0.

ganos.parallel.degree

The ganos.parallel.degree Grand Unified Configuration (GUC) parameter sets the default degree of parallelism (DOP). The default value is 1, which disables parallel execution.

When a function that supports parallel operations is called without an explicit DOP, or with DOP set to 0, the system uses the value of ganos.parallel.degree as the DOP.

For functions that support parallel raster-level operations, pass the DOP directly in the function call to split computation on a raster object into that number of parallel tasks:

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

ganos.parallel.transaction

The ganos.parallel.transaction GUC parameter controls the transactional consistency mode for parallel operations. Valid values:

Value

Description

transaction_commit (default)

Parallel transactions commit or roll back with the primary transaction. Use this mode when data consistency is required.

fast_commit

Parallel transactions cannot be rolled back. Use this mode for higher throughput when rollback support is not needed.

Parallel SQL statements

How parallel SQL statements work

PostgreSQL generates multiple parallel query plans and distributes them across available CPU cores. Each core processes a portion of the data independently, reducing overall query execution time.

When to use parallel SQL statements

Use parallel SQL statements when scanning a large number of raster objects to identify those that meet specific spatial or attribute criteria. This reduces query execution time for read-heavy analytical workloads.

Supported scope

All read-only GanosBase functions that compute or query the attributes of raster objects support parallel queries.

Parallel raster-level operations

How parallel raster-level operations work

GanosBase divides a raster object into subsets and assigns each subset to a separate CPU core. Each subset is computed independently. After all subsets finish, the results are merged and the operation completes. This reduces the total computation time for large raster objects.

When to use raster-level parallelism

Use raster-level parallelism when processing a single large raster object whose computation would take a long time to complete serially.

Supported functions

The following functions support parallel raster-level operations.

Data import and mosaic

  • ST_ImportFrom — imports raster data from an external source into a chunk table

  • ST_MosaicFrom — merges multiple raster objects or files into a single mosaic

Pyramid building

  • ST_BuildPyramid — builds a multi-resolution pyramid for faster tile rendering

Geometric correction

  • ST_RPCRectify — applies RPC-based geometric correction to satellite imagery

Subsetting

  • ST_SubRaster — extracts a spatial or band-based subset from a raster object

Statistics and analysis

Image processing

Before you begin

  • Create a chunk table in advance using ST_CreateChunkTable to ensure optimal performance.

  • If a parallel function cannot return a temporary chunk table created by an anonymous user, create the chunk table first and specify it in the chunktable parameter.