Re: Account for cost and selectivity of HAVING quals

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tels <nospam-pg-abuse(at)bloodgate(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Account for cost and selectivity of HAVING quals
Date: 2017-10-31 23:54:08
Message-ID: CAKFQuwb=ZKj1RnJBt4fn1xhBdRJGPJfsHEs0HYrNgD9zgvU35g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 31, 2017 at 4:31 PM, Tels <nospam-pg-abuse(at)bloodgate(dot)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. The
side-effect of the effort is that the number of output_tuples has now been
reduced to only those matching the qual - and so it now must take on a new
value to represent this.

David J.​

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-10-31 23:59:33 Re: Account for cost and selectivity of HAVING quals
Previous Message Oleg Ivanov 2017-10-31 23:43:59 Proposal: generic WAL compression