pgsql: Generate parallel sequential scan plans in simple cases.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Generate parallel sequential scan plans in simple cases.
Date: 2015-11-11 14:03:05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Generate parallel sequential scan plans in simple cases.

Add a new flag, consider_parallel, to each RelOptInfo, indicating
whether a plan for that relation could conceivably be run inside of
a parallel worker. Right now, we're pretty conservative: for example,
it might be possible to defer applying a parallel-restricted qual
in a worker, and later do it in the leader, but right now we just
don't try to parallelize access to that relation. That's probably
the right decision in most cases, anyway.

Using the new flag, generate parallel sequential scan plans for plain
baserels, meaning that we now have parallel sequential scan in
PostgreSQL. The logic here is pretty unsophisticated right now: the
costing model probably isn't right in detail, and we can't push joins
beneath Gather nodes, so the number of plans that can actually benefit
from this is pretty limited right now. Lots more work is needed.
Nevertheless, it seems time to enable this functionality so that all
this code can actually be tested easily by users and developers.

Note that, if you wish to test this functionality, it will be
necessary to set max_parallel_degree to a value greater than the
default of 0. Once a few more loose ends have been tidied up here, we
might want to consider changing the default value of this GUC, but
I'm leaving it alone for now.

Along the way, fix a bug in cost_gather: the previous coding thought
that a Gather node's transfer overhead should be costed on the basis of
the relation size rather than the number of tuples that actually need
to be passed off to the leader.

Patch by me, reviewed in earlier versions by Amit Kapila.



Modified Files
src/backend/nodes/outfuncs.c | 1 +
src/backend/optimizer/path/allpaths.c | 190 ++++++++++++++++++++++++++++++++-
src/backend/optimizer/path/costsize.c | 2 +-
src/backend/optimizer/plan/planmain.c | 12 +++
src/backend/optimizer/plan/planner.c | 9 +-
src/backend/optimizer/util/clauses.c | 183 +++++++++++++++++++++++++------
src/backend/optimizer/util/relnode.c | 21 ++++
src/backend/utils/cache/lsyscache.c | 22 ++++
src/include/nodes/relation.h | 1 +
src/include/optimizer/clauses.h | 2 +-
src/include/utils/lsyscache.h | 1 +
11 files changed, 400 insertions(+), 44 deletions(-)


Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2015-11-11 15:32:24 Re: pgsql: Generate parallel sequential scan plans in simple cases.
Previous Message Robert Haas 2015-11-11 14:02:49 pgsql: Make sequential scans parallel-aware.