v6-0006-Do-not-lock-all-partitions-at-the-beginning.patch

text/plain

Filename: v6-0006-Do-not-lock-all-partitions-at-the-beginning.patch
Type: text/plain
Part: 5
Message: Re: speeding up planning with partitions

Patch

Format: format-patch
Series: patch v6-0006
Subject: Do not lock all partitions at the beginning
File+
src/backend/optimizer/util/append.c 1 6
From d4387591743853cdaa6a21d17a3560a8e0d671d6 Mon Sep 17 00:00:00 2001
From: amit <amitlangote09@gmail.com>
Date: Fri, 12 Oct 2018 19:12:53 +0900
Subject: [PATCH v6 6/6] Do not lock all partitions at the beginning

---
 src/backend/optimizer/util/append.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/backend/optimizer/util/append.c b/src/backend/optimizer/util/append.c
index 3b3fb304b9..0b0b75d409 100644
--- a/src/backend/optimizer/util/append.c
+++ b/src/backend/optimizer/util/append.c
@@ -335,10 +335,6 @@ expand_partitioned_rtentry(PlannerInfo *root, RangeTblEntry *parentrte,
 									parentrel->inh_root_parent :
 									parentRTindex;
 
-	/* If root partitioned table, lock *all* partitions in the tree. */
-	if (parentRTindex == rootParentRTindex)
-		(void) find_all_inheritors(parentrte->relid, lockmode, NULL);
-
 	/*
 	 * Initialize partitioned_child_rels to contain this RT index.
 	 *
@@ -374,8 +370,7 @@ expand_partitioned_rtentry(PlannerInfo *root, RangeTblEntry *parentrte,
 		RangeTblEntry *childrte;
 		Index		childRTindex;
 
-		/* Already locked above. */
-		newrelation = heap_open(childOID, NoLock);
+		newrelation = heap_open(childOID, lockmode);
 		Assert(!RELATION_IS_OTHER_TEMP(newrelation));
 
 		/*
-- 
2.11.0