pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix parallel query so it doesn't spoil row estimates above Gathe
Date: Sat, 01 Apr 2017 01:13:26 +0000
Message-ID: <E1cu7ba-0001sp-10@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix parallel query so it doesn't spoil row estimates above Gather.

Commit 45be99f8cd5d606086e0a458c9c72910ba8a613d removed GatherPath's
num_workers field, but this is entirely bogus.  Normally, a path's
parallel_workers flag is supposed to indicate the number of workers
that it wants, and should be 0 for a non-partial path.  In that
commit, I mistakenly thought that GatherPath could also use that field
to indicate the number of workers that it would try to start, but
that's disastrous, because then it can propagate up to higher nodes in
the plan tree, which will then get incorrect rowcounts because the
parallel_workers flag is involved in computing those values.  Repair
by putting the separate field back.

Report by Tomas Vondra.  Patch by me, reviewed by Amit Kapila.

Discussion: http://postgr.es/m/f91b4a44-f739-04bd-c4b6-f135bd643669@2ndquadrant.com

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/fb1879c374581c0f0e251e94c0087c8385b91f5b

Modified Files
--------------
src/backend/nodes/outfuncs.c            | 1 +
src/backend/optimizer/plan/createplan.c | 2 +-
src/backend/optimizer/util/pathnode.c   | 7 ++++---
src/include/nodes/relation.h            | 1 +
4 files changed, 7 insertions(+), 4 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 (2+ messages)

Message-ID: <E1cu7ba-0001sp-10@gemulon.postgresql.org>
Permalink:  ../E1cu7ba-0001sp-10@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cu7ba-0001sp-10@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: rhaas@postgresql.org
  Subject: Re: pgsql: Fix parallel query so it doesn't spoil row estimates above Gathe
  In-Reply-To: <E1cu7ba-0001sp-10@gemulon.postgresql.org>
  References: <E1cu7ba-0001sp-10@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