mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Don't scan partitioned tables.
Partitioned tables do not contain any data; only their unpartitioned descendents need to be scanned. However, the partitioned tables still need to be locked, even though they're not scanned. To make that work, Append and MergeAppend relations now need to carry a list of (unscanned) partitioned relations that must be locked, and InitPlan must lock all partitioned result relations. Aside from the obvious advantage of avoiding some work at execution time, this has two other advantages. First, it may improve the planner's decision-making in some cases since the empty relation might throw things off. Second, it paves the way to getting rid of the storage for partitioned tables altogether. Amit Langote, reviewed by me. Discussion: http://postgr.es/m/6837c359-45c4-8044-34d1-736756335a15@lab.ntt.co.jp
This commit is contained in:
@@ -64,12 +64,14 @@ extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root,
|
||||
extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
List *tidquals, Relids required_outer);
|
||||
extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths,
|
||||
Relids required_outer, int parallel_workers);
|
||||
Relids required_outer, int parallel_workers,
|
||||
List *partitioned_rels);
|
||||
extern MergeAppendPath *create_merge_append_path(PlannerInfo *root,
|
||||
RelOptInfo *rel,
|
||||
List *subpaths,
|
||||
List *pathkeys,
|
||||
Relids required_outer);
|
||||
Relids required_outer,
|
||||
List *partitioned_rels);
|
||||
extern ResultPath *create_result_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
PathTarget *target, List *resconstantqual);
|
||||
extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath);
|
||||
@@ -232,7 +234,7 @@ extern LockRowsPath *create_lockrows_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
extern ModifyTablePath *create_modifytable_path(PlannerInfo *root,
|
||||
RelOptInfo *rel,
|
||||
CmdType operation, bool canSetTag,
|
||||
Index nominalRelation,
|
||||
Index nominalRelation, List *partitioned_rels,
|
||||
List *resultRelations, List *subpaths,
|
||||
List *subroots,
|
||||
List *withCheckOptionLists, List *returningLists,
|
||||
|
||||
@@ -57,4 +57,6 @@ extern Expr *preprocess_phv_expression(PlannerInfo *root, Expr *expr);
|
||||
|
||||
extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid);
|
||||
|
||||
extern List *get_partitioned_child_rels(PlannerInfo *root, Index rti);
|
||||
|
||||
#endif /* PLANNER_H */
|
||||
|
||||
Reference in New Issue
Block a user