aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/functions.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-03-24 14:46:33 -0400
committerRobert Haas <rhaas@postgresql.org>2017-03-24 14:46:33 -0400
commit61c2e1a95f94bb904953a6281ce17a18ac38ee6d (patch)
tree35e2b75f7482cfa9c924ff8fae376be162a6a088 /src/backend/executor/functions.c
parent8082bea2b06eb6bcd6cce4cc7801094c17045b4f (diff)
downloadpostgresql-61c2e1a95f94bb904953a6281ce17a18ac38ee6d.tar.gz
postgresql-61c2e1a95f94bb904953a6281ce17a18ac38ee6d.zip
Improve access to parallel query from procedural languages.
In SQL, the ability to use parallel query was previous contingent on fcache->readonly_func, which is only set for non-volatile functions; but the volatility of a function has no bearing on whether queries inside it can use parallelism. Remove that condition. SPI_execute and SPI_execute_with_args always run the plan just once, though not necessarily to completion. Given the changes in commit 691b8d59281b5177f16fe80858df921f77a8e955, it's sensible to pass CURSOR_OPT_PARALLEL_OK here, so do that. This improves access to parallelism for any caller that uses these functions to execute queries. Such callers include plperl, plpython, pltcl, and plpgsql, though it's not the case that they all use these functions exclusively. In plpgsql, allow parallel query for plain SELECT queries (as opposed to PERFORM, which already worked) and for plain expressions (which probably won't go through the executor at all, because they will likely be simple expressions, but if they do then this helps). Rafia Sabih and Robert Haas, reviewed by Dilip Kumar and Amit Kapila Discussion: http://postgr.es/m/CAOGQiiMfJ+4SQwgG=6CVHWoisiU0+7jtXSuiyXBM3y=A=eJzmg@mail.gmail.com
Diffstat (limited to 'src/backend/executor/functions.c')
-rw-r--r--src/backend/executor/functions.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 12214f8a150..65e52cca630 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -503,7 +503,7 @@ init_execution_state(List *queryTree_list,
}
else
stmt = pg_plan_query(queryTree,
- fcache->readonly_func ? CURSOR_OPT_PARALLEL_OK : 0,
+ CURSOR_OPT_PARALLEL_OK,
NULL);
/*