pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix testing of parallel-safety of SubPlans.
Date: Tue, 18 Apr 2017 19:44:07 +0000
Message-ID: <E1d0Z2l-0005vL-0l@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix testing of parallel-safety of SubPlans.

is_parallel_safe() supposed that the only relevant property of a SubPlan
was the parallel safety of the referenced subplan tree.  This is wrong:
the testexpr or args subtrees might contain parallel-unsafe stuff, as
demonstrated by the test case added here.  However, just recursing into the
subtrees fails in a different way: we'll typically find PARAM_EXEC Params
representing the subplan's output columns in the testexpr.  The previous
coding supposed that any Param must be treated as parallel-restricted, so
that a naive attempt at fixing this disabled parallel pushdown of SubPlans
altogether.  We must instead determine, for any visited Param, whether it
is one that would be computed by a surrounding SubPlan node; if so, it's
safe to push down along with the SubPlan node.

We might later be able to extend this logic to cope with Params used for
correlated subplans and other cases; but that's a task for v11 or beyond.

Tom Lane and Amit Kapila

Discussion: https://postgr.es/m/7064.1492022469@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/39151781c8cd2c8bf6057496426fb9c07178eda5

Modified Files
--------------
src/backend/optimizer/util/clauses.c          | 44 ++++++++++++++++++++++++---
src/include/nodes/primnodes.h                 |  3 +-
src/test/regress/expected/select_parallel.out | 12 ++++++++
src/test/regress/sql/select_parallel.sql      |  4 +++
4 files changed, 57 insertions(+), 6 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (3+ messages)  latest in thread

Message-ID: <E1d0Z2l-0005vL-0l@gemulon.postgresql.org>
Permalink:  ../E1d0Z2l-0005vL-0l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1d0Z2l-0005vL-0l@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix testing of parallel-safety of SubPlans.
  In-Reply-To: <E1d0Z2l-0005vL-0l@gemulon.postgresql.org>
  References: <E1d0Z2l-0005vL-0l@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox