pgsql: Speed up planner's scanning for parallel-query hazards.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Speed up planner's scanning for parallel-query hazards.
Date: 2016-08-19 18:03:32
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Speed up planner's scanning for parallel-query hazards.

We need to scan the whole parse tree for parallel-unsafe functions.
If there are none, we'll later need to determine whether particular
subtrees contain any parallel-restricted functions. The previous coding
retained no knowledge from the first scan, even though this is very
wasteful in the common case where the query contains only parallel-safe
functions. We can bypass all of the later scans by remembering that fact.
This provides a small but measurable speed improvement when the case
applies, and shouldn't cost anything when it doesn't.

Patch by me, reviewed by Robert Haas

Discussion: <3740(dot)1471538387(at)sss(dot)pgh(dot)pa(dot)us>



Modified Files
src/backend/nodes/outfuncs.c | 1 +
src/backend/optimizer/path/allpaths.c | 30 ++-------
src/backend/optimizer/plan/planmain.c | 9 ++-
src/backend/optimizer/plan/planner.c | 43 ++++++++-----
src/backend/optimizer/util/clauses.c | 115 +++++++++++++++++++++++++---------
src/backend/optimizer/util/pathnode.c | 6 +-
src/backend/optimizer/util/relnode.c | 4 +-
src/include/nodes/relation.h | 2 +
src/include/optimizer/clauses.h | 3 +-
9 files changed, 133 insertions(+), 80 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-08-19 18:35:51 pgsql: Guard against parallel-restricted functions in VALUES expression
Previous Message Alvaro Herrera 2016-08-19 17:40:23 pgsql: reorderbuffer: preserve errno while reporting error