aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planner.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-03-07 08:31:07 +0900
committerMichael Paquier <michael@paquier.xyz>2024-03-07 08:31:07 +0900
commit49b971298a9b4271a9d5f91dcc969c5cb1acfbc1 (patch)
tree69ae1bcbcbd9d56f77f308ce673299e271edf6a8 /src/backend/optimizer/plan/planner.c
parenta595c3075fb4b8ab4211b074485eb0a17062ec7f (diff)
downloadpostgresql-49b971298a9b4271a9d5f91dcc969c5cb1acfbc1.tar.gz
postgresql-49b971298a9b4271a9d5f91dcc969c5cb1acfbc1.zip
Revert "Fix parallel-safety check of expressions and predicate for index builds"
This reverts commit eae7be600be7, following a discussion with Tom Lane, due to concerns that this impacts the decisions made by the planner for the number of workers spawned based on the inlining and const-folding of index expressions and predicate for cases that would have worked until this commit. Discussion: https://postgr.es/m/162802.1709746091@sss.pgh.pa.us Backpatch-through: 12
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r--src/backend/optimizer/plan/planner.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 88cb97f445f..5da863d85de 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -5911,18 +5911,10 @@ plan_create_index_workers(Oid tableOid, Oid indexOid)
* Currently, parallel workers can't access the leader's temporary tables.
* Furthermore, any index predicate or index expressions must be parallel
* safe.
- *
- * Fetch the list of expressions and predicates directly from the
- * catalogs. Retrieving this information from the relcache would cause
- * the expressions and predicates to be flattened, losing properties that
- * can be important to check if parallel workers can be used. For
- * example, immutable parallel-unsafe functions, that cannot be used in
- * parallel workers, would be changed to Const nodes, that are safe in
- * parallel workers.
*/
if (heap->rd_rel->relpersistence == RELPERSISTENCE_TEMP ||
- !is_parallel_safe(root, (Node *) get_index_expressions(indexOid)) ||
- !is_parallel_safe(root, (Node *) get_index_predicate(indexOid)))
+ !is_parallel_safe(root, (Node *) RelationGetIndexExpressions(index)) ||
+ !is_parallel_safe(root, (Node *) RelationGetIndexPredicate(index)))
{
parallel_workers = 0;
goto done;