pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tels <nospam-pg-abuse@bloodgate.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Account for cost and selectivity of HAVING quals
Date: Tue, 31 Oct 2017 19:31:29 -0400
Message-ID: <0410ddd44e3823059cf7d39f9b3e82c4.squirrel@sm.webmail.pair.com> (raw)
In-Reply-To: <20968.1509486337@sss.pgh.pa.us>
References: <20968.1509486337@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Moin,

On Tue, October 31, 2017 5:45 pm, Tom Lane wrote:
> Pursuant to the discussion at
> https://www.postgresql.org/message-id/20171029112420.8920B5FB05@mx.zeyos.com
> here's a patch to fix the planner so that eval costs and selectivity of
> HAVING quals are factored into the appropriate plan node numbers.
> Perhaps unsurprisingly, this doesn't change the results of any
> existing regression tests.
>
> It's slightly annoying that this approach will result in calculating
> the eval costs and selectivity several times, once for each aggregation
> plan type we consider.  I thought about inserting RestrictInfo nodes
> into the havingQual so that those numbers could be cached, but that turned
> out to break various code that doesn't expect to see such nodes there.
> I'm not sure it's worth going to the trouble of fixing that; in the big
> scheme of things, the redundant calculations likely don't cost much, since
> we aren't going to have relevant statistics.
>
> Comments?  If anyone wants to do a real review of this, I'm happy to stick
> it into the upcoming CF; but without an expression of interest, I'll just
> push it.  I don't think there's anything terribly controversial here.

Not a review, but the patch has this:


+                 total_cost += qual_cost.startup + output_tuples *
qual_cost.per_tuple;
+
+                 output_tuples = clamp_row_est(output_tuples *

...

That looks odd to me, it first uses output_tuples in a formula, then
overwrites the value with a new value. Should these lines be swapped?

Best regards,

Tels


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



view thread (8+ messages)  latest in thread

Message-ID: <0410ddd44e3823059cf7d39f9b3e82c4.squirrel@sm.webmail.pair.com>
Permalink:  ../0410ddd44e3823059cf7d39f9b3e82c4.squirrel@sm.webmail.pair.com/
Also on:    postgresql.org/message-id/0410ddd44e3823059cf7d39f9b3e82c4.squirrel@sm.webmail.pair.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nospam-pg-abuse@bloodgate.com, tgl@sss.pgh.pa.us
  Subject: Re: Account for cost and selectivity of HAVING quals
  In-Reply-To: <0410ddd44e3823059cf7d39f9b3e82c4.squirrel@sm.webmail.pair.com>

* 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