aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeTidscan.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-12-02 20:03:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-12-02 20:03:42 +0000
commitd780f07ac1ea97e2d3cf906cc1c9d59d6b21c5e2 (patch)
treee13c3013e4ede366298875eeb77197a07f7c4b54 /src/backend/executor/nodeTidscan.c
parent5ab25988753ff495f3fd0b54ef00ba80d0d2808c (diff)
downloadpostgresql-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/nodeTidscan.c')
-rw-r--r--src/backend/executor/nodeTidscan.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index ba4b7f3bca8..e6d61c78a6c 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.45 2005/11/26 22:14:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.46 2005/12/02 20:03:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -421,12 +421,8 @@ ExecEndTidScan(TidScanState *node)
/*
* close the heap relation.
- *
- * Currently, we do not release the AccessShareLock acquired by
- * ExecInitTidScan. This lock should be held till end of transaction.
- * (There is a faction that considers this too much locking, however.)
*/
- heap_close(node->ss.ss_currentRelation, NoLock);
+ ExecCloseScanRelation(node->ss.ss_currentRelation);
}
/* ----------------------------------------------------------------
@@ -472,9 +468,6 @@ TidScanState *
ExecInitTidScan(TidScan *node, EState *estate)
{
TidScanState *tidstate;
- RangeTblEntry *rtentry;
- Oid relid;
- Oid reloid;
Relation currentRelation;
/*
@@ -521,15 +514,9 @@ ExecInitTidScan(TidScan *node, EState *estate)
tidstate->tss_TidPtr = -1;
/*
- * open the base relation
- *
- * We acquire AccessShareLock for the duration of the scan.
+ * 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);
tidstate->ss.ss_currentRelation = currentRelation;
tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */