Updated on 2025-05-29 GMT+08:00

Partition Pruning

Partition pruning is a technology provided by GaussDB to optimize partitioned table queries. The database SQL engine scans only some specific partitions based on query conditions. This optimization action is automatically triggered. When the query conditions of a partitioned table meet the pruning scenario, partition pruning is automatically started.

Partition pruning can be classified into static pruning and dynamic pruning based on the pruning phase.

  • Static pruning occurs in the optimizer phase. Before the execution plan is generated, the database has obtained the information about the partitions to be accessed.
  • Dynamic pruning is implemented in the executor phase (when the execution starts or is in progress). When an execution plan is generated, the database does not know the partitions to be accessed and only determines that the partition pruning conditions are met. The specific pruning details are determined by the executor.

Note that partition pruning is triggered only by partitioned table page scan and local index scan. Global indexes do not have the concept of partitioning and do not need to be pruned.