pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Rijkers <er@xs4all.nl>
To: ladayaroslav@yandex.ru
To: pgsql-bugs@lists.postgresql.org
Cc: PG Bug reporting form <noreply@postgresql.org>
Subject: Re: BUG #15947: Worse plan is chosen after giving the planner more freedom (partitionwise join)
Date: Sun, 11 Aug 2019 01:54:01 +0200
Message-ID: <a68a00b2971fa21bc2ee3a3f7df9d916@xs4all.nl> (raw)
In-Reply-To: <15947-c242874031212a07@postgresql.org>
References: <15947-c242874031212a07@postgresql.org>

On 2019-08-11 00:28, PG Bug reporting form wrote:
> The following bug has been logged on the website:
> 
> Bug reference:      15947
> I'm trying the following query:
> 
> EXPLAIN
> SELECT COUNT(*)
>   FROM sc
>  WHERE EXISTS (
>        SELECT 1
>          FROM sg
>         WHERE sc.id = sg.sc_fk
>           AND sc.a = sg.a
>           AND sc.o = sg.o
>           AND sc.sl = sg.sl
>        );
> 
> Which produces the plan with this cost estimation (top node):
> -- Aggregate  (cost=147.25..147.26 rows=1 width=8)
> 
> But after:
> SET enable_partitionwise_join = true;
> 
> The new plan is more expensive:
> -- Aggregate  (cost=175.00..175.01 rows=1 width=8)
> 
> This shouldn't be happening, right?

Why not?

The 'worse plan' cnsistently executes faster.

I don't think the cost units of different queries can/should be compared 
as if they are the same.
























view thread (4+ messages)  latest in thread

Message-ID: <a68a00b2971fa21bc2ee3a3f7df9d916@xs4all.nl>
Permalink:  ../a68a00b2971fa21bc2ee3a3f7df9d916@xs4all.nl/
Also on:    postgresql.org/message-id/a68a00b2971fa21bc2ee3a3f7df9d916@xs4all.nl

 · 

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-bugs@postgresql.org
  Cc: er@xs4all.nl, ladayaroslav@yandex.ru, noreply@postgresql.org
  Subject: Re: BUG #15947: Worse plan is chosen after giving the planner more freedom (partitionwise join)
  In-Reply-To: <a68a00b2971fa21bc2ee3a3f7df9d916@xs4all.nl>
  References: <15947-c242874031212a07@postgresql.org> <a68a00b2971fa21bc2ee3a3f7df9d916@xs4all.nl>

* 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