From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Tels <nospam-pg-abuse@bloodgate.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Account for cost and selectivity of HAVING quals
Date: Tue, 31 Oct 2017 19:59:33 -0400
Message-ID: <1464.1509494373@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwb=ZKj1RnJBt4fn1xhBdRJGPJfsHEs0HYrNgD9zgvU35g@mail.gmail.com>
References: <20968.1509486337@sss.pgh.pa.us>
<0410ddd44e3823059cf7d39f9b3e82c4.squirrel@sm.webmail.pair.com>
<CAKFQuwb=ZKj1RnJBt4fn1xhBdRJGPJfsHEs0HYrNgD9zgvU35g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, Oct 31, 2017 at 4:31 PM, Tels <nospam-pg-abuse@bloodgate.com> wrote:
>> 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?
> IIUC it is correct: the additional total_cost comes from processing every
> output group to check whether it is qualified - since every group is
> checked the incoming output_tuples from the prior grouping is used.
Right --- we'll expend the effort to compute the HAVING expression once
per group row, whether the row passes the qual or not.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, nospam-pg-abuse@bloodgate.com
Subject: Re: Account for cost and selectivity of HAVING quals
In-Reply-To: <1464.1509494373@sss.pgh.pa.us>
* 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