mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Revert "Enable parallel SELECT for "INSERT INTO ... SELECT ..."."
To allow inserts in parallel-mode this feature has to ensure that all the constraints, triggers, etc. are parallel-safe for the partition hierarchy which is costly and we need to find a better way to do that. Additionally, we could have used existing cached information in some cases like indexes, domains, etc. to determine the parallel-safety. List of commits reverted, in reverse chronological order:ed62d3737cDoc: Update description for parallel insert reloption.c8f78b6161Add a new GUC and a reloption to enable inserts in parallel-mode.c5be48f092Improve FK trigger parallel-safety check added by05c8482f7f.e2cda3c20aFix use of relcache TriggerDesc field introduced by commit05c8482f7f.e4e87a32ccFix valgrind issue in commit05c8482f7f.05c8482f7fEnable parallel SELECT for "INSERT INTO ... SELECT ...". Discussion: https://postgr.es/m/E1lMiB9-0001c3-SY@gemulon.postgresql.org
This commit is contained in:
33
src/backend/utils/cache/plancache.c
vendored
33
src/backend/utils/cache/plancache.c
vendored
@@ -1735,23 +1735,6 @@ QueryListGetPrimaryStmt(List *stmts)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
AcquireExecutorLocksOnPartitions(List *partitionOids, int lockmode,
|
||||
bool acquire)
|
||||
{
|
||||
ListCell *lc;
|
||||
|
||||
foreach(lc, partitionOids)
|
||||
{
|
||||
Oid partOid = lfirst_oid(lc);
|
||||
|
||||
if (acquire)
|
||||
LockRelationOid(partOid, lockmode);
|
||||
else
|
||||
UnlockRelationOid(partOid, lockmode);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* AcquireExecutorLocks: acquire locks needed for execution of a cached plan;
|
||||
* or release them if acquire is false.
|
||||
@@ -1765,8 +1748,6 @@ AcquireExecutorLocks(List *stmt_list, bool acquire)
|
||||
{
|
||||
PlannedStmt *plannedstmt = lfirst_node(PlannedStmt, lc1);
|
||||
ListCell *lc2;
|
||||
Index rti,
|
||||
resultRelation = 0;
|
||||
|
||||
if (plannedstmt->commandType == CMD_UTILITY)
|
||||
{
|
||||
@@ -1784,9 +1765,6 @@ AcquireExecutorLocks(List *stmt_list, bool acquire)
|
||||
continue;
|
||||
}
|
||||
|
||||
rti = 1;
|
||||
if (plannedstmt->resultRelations)
|
||||
resultRelation = linitial_int(plannedstmt->resultRelations);
|
||||
foreach(lc2, plannedstmt->rtable)
|
||||
{
|
||||
RangeTblEntry *rte = (RangeTblEntry *) lfirst(lc2);
|
||||
@@ -1804,14 +1782,6 @@ AcquireExecutorLocks(List *stmt_list, bool acquire)
|
||||
LockRelationOid(rte->relid, rte->rellockmode);
|
||||
else
|
||||
UnlockRelationOid(rte->relid, rte->rellockmode);
|
||||
|
||||
/* Lock partitions ahead of modifying them in parallel mode. */
|
||||
if (rti == resultRelation &&
|
||||
plannedstmt->partitionOids != NIL)
|
||||
AcquireExecutorLocksOnPartitions(plannedstmt->partitionOids,
|
||||
rte->rellockmode, acquire);
|
||||
|
||||
rti++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2020,8 +1990,7 @@ PlanCacheRelCallback(Datum arg, Oid relid)
|
||||
if (plannedstmt->commandType == CMD_UTILITY)
|
||||
continue; /* Ignore utility statements */
|
||||
if ((relid == InvalidOid) ? plannedstmt->relationOids != NIL :
|
||||
(list_member_oid(plannedstmt->relationOids, relid) ||
|
||||
list_member_oid(plannedstmt->partitionOids, relid)))
|
||||
list_member_oid(plannedstmt->relationOids, relid))
|
||||
{
|
||||
/* Invalidate the generic plan only */
|
||||
plansource->gplan->is_valid = false;
|
||||
|
||||
Reference in New Issue
Block a user