mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Tweak indexscan machinery to avoid taking an AccessShareLock on an index
if we already have a stronger lock due to the index's table being the update target table of the query. Same optimization I applied earlier at the table level. There doesn't seem to be much interest in the more radical idea of not locking indexes at all, so do what we can ...
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.130 2005/12/02 20:03:40 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.131 2005/12/03 05:51:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -693,6 +693,28 @@ ExecAssignScanTypeFromOuterPlan(ScanState *scanstate)
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecRelationIsTargetRelation
|
||||
*
|
||||
* Detect whether a relation (identified by rangetable index)
|
||||
* is one of the target relations of the query.
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
bool
|
||||
ExecRelationIsTargetRelation(EState *estate, Index scanrelid)
|
||||
{
|
||||
ResultRelInfo *resultRelInfos;
|
||||
int i;
|
||||
|
||||
resultRelInfos = estate->es_result_relations;
|
||||
for (i = 0; i < estate->es_num_result_relations; i++)
|
||||
{
|
||||
if (resultRelInfos[i].ri_RangeTableIndex == scanrelid)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecOpenScanRelation
|
||||
*
|
||||
|
Reference in New Issue
Block a user