mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
Add GUC enable_partition_pruning
This controls both plan-time and execution-time new-style partition pruning. While finer-grain control is possible (maybe using an enum GUC instead of boolean), there doesn't seem to be much need for that. This new parameter controls partition pruning for all queries: trivially, SELECT queries that affect partitioned tables are naturally under its control since they are using the new technology. However, while UPDATE/DELETE queries do not use the new code, we make the new GUC control their behavior also (stealing control from constraint_exclusion), because it is more natural, and it leads to a more natural transition to the future in which those queries will also use the new pruning code. Constraint exclusion still controls pruning for regular inheritance situations (those not involving partitioned tables). Author: David Rowley Review: Amit Langote, Ashutosh Bapat, Justin Pryzby, David G. Johnston Discussion: https://postgr.es/m/CAKJS1f_0HwsxJG9m+nzU+CizxSdGtfe6iF_ykPYBiYft302DCw@mail.gmail.com
This commit is contained in:
@@ -82,6 +82,17 @@ typedef enum UpperRelationKind
|
||||
/* NB: UPPERREL_FINAL must be last enum entry; it's used to size arrays */
|
||||
} UpperRelationKind;
|
||||
|
||||
/*
|
||||
* This enum identifies which type of relation is being planned through the
|
||||
* inheritance planner. INHKIND_NONE indicates the inheritance planner
|
||||
* was not used.
|
||||
*/
|
||||
typedef enum InheritanceKind
|
||||
{
|
||||
INHKIND_NONE,
|
||||
INHKIND_INHERITED,
|
||||
INHKIND_PARTITIONED
|
||||
} InheritanceKind;
|
||||
|
||||
/*----------
|
||||
* PlannerGlobal
|
||||
@@ -298,8 +309,9 @@ typedef struct PlannerInfo
|
||||
Index qual_security_level; /* minimum security_level for quals */
|
||||
/* Note: qual_security_level is zero if there are no securityQuals */
|
||||
|
||||
bool hasInheritedTarget; /* true if parse->resultRelation is an
|
||||
* inheritance child rel */
|
||||
InheritanceKind inhTargetKind; /* indicates if the target relation is an
|
||||
* inheritance child or partition or a
|
||||
* partitioned table */
|
||||
bool hasJoinRTEs; /* true if any RTEs are RTE_JOIN kind */
|
||||
bool hasLateralRTEs; /* true if any RTEs are marked LATERAL */
|
||||
bool hasDeletedRTEs; /* true if any RTE was deleted from jointree */
|
||||
|
||||
@@ -71,6 +71,7 @@ extern PGDLLIMPORT bool enable_partitionwise_join;
|
||||
extern PGDLLIMPORT bool enable_partitionwise_aggregate;
|
||||
extern PGDLLIMPORT bool enable_parallel_append;
|
||||
extern PGDLLIMPORT bool enable_parallel_hash;
|
||||
extern PGDLLIMPORT bool enable_partition_pruning;
|
||||
extern PGDLLIMPORT int constraint_exclusion;
|
||||
|
||||
extern double clamp_row_est(double nrows);
|
||||
|
||||
Reference in New Issue
Block a user