diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-12-02 20:03:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-12-02 20:03:42 +0000 |
commit | d780f07ac1ea97e2d3cf906cc1c9d59d6b21c5e2 (patch) | |
tree | e13c3013e4ede366298875eeb77197a07f7c4b54 /src/backend/executor/nodeBitmapHeapscan.c | |
parent | 5ab25988753ff495f3fd0b54ef00ba80d0d2808c (diff) | |
download | postgresql-d780f07ac1ea97e2d3cf906cc1c9d59d6b21c5e2.tar.gz postgresql-d780f07ac1ea97e2d3cf906cc1c9d59d6b21c5e2.zip |
Adjust scan plan nodes to avoid getting an extra AccessShareLock on a
relation if it's already been locked by execMain.c as either a result
relation or a FOR UPDATE/SHARE relation. This avoids an extra trip to
the shared lock manager state. Per my suggestion yesterday.
Diffstat (limited to 'src/backend/executor/nodeBitmapHeapscan.c')
-rw-r--r-- | src/backend/executor/nodeBitmapHeapscan.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 37bd42d9d73..959b559d1b0 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -21,7 +21,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.7 2005/12/02 01:29:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.8 2005/12/02 20:03:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -141,9 +141,9 @@ BitmapHeapNext(BitmapHeapScanState *node) /* * Ignore any claimed entries past what we think is the end of the - * relation. (This is probably not necessary given that we got - * AccessShareLock before performing any of the indexscans, but - * let's be safe.) + * relation. (This is probably not necessary given that we got at + * least AccessShareLock on the table before performing any of the + * indexscans, but let's be safe.) */ if (tbmres->blockno >= scan->rs_nblocks) { @@ -448,13 +448,8 @@ ExecEndBitmapHeapScan(BitmapHeapScanState *node) /* * close the heap relation. - * - * Currently, we do not release the AccessShareLock acquired by - * ExecInitBitmapHeapScan. This lock should be held till end of - * transaction. (There is a faction that considers this too much locking, - * however.) */ - heap_close(relation, NoLock); + ExecCloseScanRelation(relation); } /* ---------------------------------------------------------------- @@ -467,9 +462,6 @@ BitmapHeapScanState * ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate) { BitmapHeapScanState *scanstate; - RangeTblEntry *rtentry; - Index relid; - Oid reloid; Relation currentRelation; /* @@ -519,13 +511,9 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate) CXT1_printf("ExecInitBitmapHeapScan: context is %d\n", CurrentMemoryContext); /* - * open the base relation and acquire AccessShareLock on it. + * open the base relation and acquire appropriate lock on it. */ - relid = node->scan.scanrelid; - rtentry = rt_fetch(relid, estate->es_range_table); - reloid = rtentry->relid; - - currentRelation = heap_open(reloid, AccessShareLock); + currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid); scanstate->ss.ss_currentRelation = currentRelation; |