Re: AGG_HASHED cost estimate

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: AGG_HASHED cost estimate
Date: 2017-04-20 11:37:44
Message-ID: CAFiTN-v6GEJpKsmacchnSYUzGzYqhobTRhg5jEqJY86YnbnKFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 20, 2017 at 4:16 PM, Ashutosh Bapat
<ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
> but cost this without numGroups.
>
> /*
> * The transCost.per_tuple component of aggcosts should be charged once
> * per input tuple, corresponding to the costs of evaluating the aggregate
> * transfns and their input expressions (with any startup cost of course
> * charged but once). The finalCost component is charged once per output
> * tuple, corresponding to the costs of evaluating the finalfns.
> *
> * If we are grouping, we charge an additional cpu_operator_cost per
> * grouping column per input tuple for grouping comparisons.
> *
>
> The reason may be that hashing isn't as costly as a comparison. I
> don't how true is that.

Earlier in GatherMerge thread[1], Rushabh mentioned that hashAggregate
is getting picked where actually grouping aggregate with GatherMerge
was faster during actual execution time and he suspected problems with
costing of hashAggregate. Maybe this is one of those?

[1]https://www.postgresql.org/message-id/CAGPqQf2164iV6k-_M75qEZWiCfRarA_SKSmHjc0Uh1rEf5RJrA%40mail.gmail.com

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2017-04-20 11:43:14 Re: Interval for launching the table sync worker
Previous Message Petr Jelinek 2017-04-20 11:32:10 Re: snapbuild woes