Re: Account for cost and selectivity of HAVING quals

From: "Tels" <nospam-pg-abuse(at)bloodgate(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(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-11-01 07:51:38
Message-ID: 61b0807a4afa2bc3f421c0fd5959e0a1.squirrel@sm.webmail.pair.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello David,

On Tue, October 31, 2017 7:54 pm, David G. Johnston wrote:
> 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.

Ah, makes sense. Learned something new today.

Maybe it's worth to add a comment, or would everybody else beside me
understand it easily by looking at the code? :)

Thank you,

Tels

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Travers 2017-11-01 08:45:49 Re: Patch: restrict pg_rewind to whitelisted directories
Previous Message Pavel Stehule 2017-11-01 05:56:03 Re: proposal: schema variables