diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c index ff68dca..9998583 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -1,10 +1,36 @@ /*------------------------------------------------------------------------- * * partprune.c - * Parses clauses attempting to match them up to partition keys of a - * given relation and generates a set of "pruning steps", which can be - * later "executed" either from the planner or the executor to determine - * the minimum set of partitions which match the given clauses. + * This module implements partition pruning using the information + * contained in table's partition descriptor. + * + * Functionality of this module can be invoked either from the planner or the + * executor. During planning, clauses that can be matched to the table's + * partition key are turned into a set of "pruning steps", which are then + * executed to produce a set of indexes of partitions whose bounds satisfy the + * set of clauses from which a given step was constructed. When invoked from + * the executor, "pruning steps" that were generated during planning are + * executed using expressions whose values could only be known during + * execution, such as Params. + * + * There are two kinds of pruning steps -- a "base" pruning step, which + * contains information extracted from one of more OpExpr clauses that are + * matched to the (possibly multi-column) partition key, such as the + * expressions whose values to match against partition bounds and operator + * strategy to assume when determining the set of partition bounds that would + * match those expressions. Whereas, a "combine" pruning step is constructed + * for BoolExpr clauses which simply combines the outputs of the steps + * corresponding to its argument clauses using the appropriate combination + * method. All steps that are constructed are executed in succession such + * that for any "combine" step, all of the steps whose output it depends on + * are executed first and their ouput preserved. Refer to + * gen_partprune_steps_internal() for more details. + * + * A base pruning step may consist of Param expressions whose values are + * only made available during execution, in which case, pruning cannot occur + * during planning itself or it occurs only partially with other expressions + * whose values are known during planning. Such steps are included with the + * plan, so the they can be executed at an appropriate time during execution. * * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California