Updated on 2024-06-07 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. When a partitioned table query meets the pruning conditions, partition pruning is automatically triggered. Partition pruning can be classified into static pruning and dynamic pruning based on the pruning phase. Static pruning is performed in the optimizer phase. Before a plan is generated, the database knows the partitions to be accessed. Dynamic pruning is performed in the executor phase (after the execution starts and before it ends). When a plan is generated, the database does not know the partitions to be accessed and only determines that partition pruning can be performed. The executor determines which partitions are pruned.

Partition pruning is triggered only by partitioned table page scan and local index scan. Global indexes do not involve partitioning and thus pruning is not required.