pgsql: Determine whether it's safe to attempt a parallel plan for a que

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Determine whether it's safe to attempt a parallel plan for a que
Дата
Msg-id E1ZcIYj-0001gF-68@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Determine whether it's safe to attempt a parallel plan for a query.

Commit 924bcf4f16d54c55310b28f77686608684734f42 introduced a framework
for parallel computation in PostgreSQL that makes most but not all
built-in functions safe to execute in parallel mode.  In order to have
parallel query, we'll need to be able to determine whether that query
contains functions (either built-in or user-defined) that cannot be
safely executed in parallel mode.  This requires those functions to be
labeled, so this patch introduces an infrastructure for that.  Some
functions currently labeled as safe may need to be revised depending on
how pending issues related to heavyweight locking under paralllelism
are resolved.

Parallel plans can't be used except for the case where the query will
run to completion.  If portal execution were suspended, the parallel
mode restrictions would need to remain in effect during that time, but
that might make other queries fail.  Therefore, this patch introduces
a framework that enables consideration of parallel plans only when it
is known that the plan will be run to completion.  This probably needs
some refinement; for example, at bind time, we do not know whether a
query run via the extended protocol will be execution to completion or
run with a limited fetch count.  Having the client indicate its
intentions at bind time would constitute a wire protocol break.  Some
contexts in which parallel mode would be safe are not adjusted by this
patch; the default is not to try parallel plans except from call sites
that have been updated to say that such plans are OK.

This commit doesn't introduce any parallel paths or plans; it just
provides a way to determine whether they could potentially be used.
I'm committing it on the theory that the remaining parallel sequential
scan patches will also get committed to this release, hopefully in the
not-too-distant future.

Robert Haas and Amit Kapila.  Reviewed (in earlier versions) by Noah
Misch.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7aea8e4f2daa4b39ca9d1309a0c4aadb0f7ed81b

Modified Files
--------------
doc/src/sgml/catalogs.sgml            |   17 +
doc/src/sgml/ref/alter_function.sgml  |   12 +
doc/src/sgml/ref/create_function.sgml |   38 +
src/backend/catalog/pg_aggregate.c    |    1 +
src/backend/catalog/pg_proc.c         |    2 +
src/backend/commands/explain.c        |    2 +-
src/backend/commands/extension.c      |    2 +-
src/backend/commands/functioncmds.c   |   51 +-
src/backend/commands/proclang.c       |    3 +
src/backend/commands/typecmds.c       |    1 +
src/backend/executor/execMain.c       |   10 +
src/backend/executor/functions.c      |    4 +-
src/backend/nodes/copyfuncs.c         |    1 +
src/backend/nodes/outfuncs.c          |    3 +
src/backend/optimizer/plan/planner.c  |   45 +
src/backend/optimizer/util/clauses.c  |  118 +
src/backend/parser/gram.y             |    9 +-
src/backend/tcop/postgres.c           |    3 +-
src/backend/utils/cache/lsyscache.c   |   19 +
src/bin/pg_dump/pg_dump.c             |   38 +-
src/include/catalog/catversion.h      |    2 +-
src/include/catalog/pg_class.h        |    2 +-
src/include/catalog/pg_proc.h         | 5529 +++++++++++++++++----------------
src/include/catalog/pg_proc_fn.h      |    1 +
src/include/nodes/parsenodes.h        |    1 +
src/include/nodes/plannodes.h         |    2 +
src/include/nodes/relation.h          |    4 +
src/include/optimizer/clauses.h       |    1 +
src/include/parser/kwlist.h           |    1 +
src/include/utils/lsyscache.h         |    1 +
src/pl/plpgsql/src/pl_exec.c          |   20 +-
31 files changed, 3162 insertions(+), 2781 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Sync regex code with Tcl 8.6.4.
Следующее
От: Teodor Sigaev
Дата:
Сообщение: pgsql: Fix bug introduced by microvacuum for GiST