From d3cc37f1d801a6b5cad9bf179274a8d767f1ee50 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Tue, 21 Mar 2017 09:48:04 -0400 Subject: 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 --- src/backend/executor/execParallel.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/backend/executor/execParallel.c') diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index a1289e5f12e..86db73be431 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -161,6 +161,7 @@ ExecSerializePlan(Plan *plan, EState *estate) pstmt->planTree = plan; pstmt->rtable = estate->es_range_table; pstmt->resultRelations = NIL; + pstmt->nonleafResultRelations = NIL; pstmt->subplans = estate->es_plannedstmt->subplans; pstmt->rewindPlanIDs = NULL; pstmt->rowMarks = NIL; -- cgit v1.2.3