pgsql: Improve access to parallel query from procedural languages. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Improve access to parallel query from procedural languages.
Date
Msg-id E1crUHL-0004xN-Eo@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/61c2e1a95f94bb904953a6281ce17a18ac38ee6d

Modified Files
--------------
src/backend/executor/functions.c |  2 +-
src/backend/executor/spi.c       |  4 ++--
src/pl/plpgsql/src/pl_exec.c     | 30 +++++++++++++++++-------------
3 files changed, 20 insertions(+), 16 deletions(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: Fix use-after-free bug
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Check that published table exists on subscriber