From: | Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Print correct startup cost for the group aggregate. |
Date: | 2017-03-02 12:36:51 |
Message-ID: | CAGPqQf099_D2EELO3Fc28Zpb=6Q4m0CHP8EUGHAunUU1P1Zn7A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
While reading through the cost_agg() I found that startup cost for the
group aggregate is not correctly assigned. Due to this explain plan is
not printing the correct startup cost.
Without patch:
postgres=# explain select aid, sum(abalance) from pgbench_accounts where
filler like '%foo%' group by aid;
QUERY
PLAN
-------------------------------------------------------------------------------------
GroupAggregate (cost=81634.33..85102.04 rows=198155 width=12)
Group Key: aid
-> Sort (cost=81634.33..82129.72 rows=198155 width=8)
Sort Key: aid
-> Seq Scan on pgbench_accounts (cost=0.00..61487.89 rows=198155
width=8)
Filter: (filler ~~ '%foo%'::text)
(6 rows)
With patch:
postgres=# explain select aid, sum(abalance) from pgbench_accounts where
filler like '%foo%' group by aid;
QUERY
PLAN
-------------------------------------------------------------------------------------
GroupAggregate (cost=82129.72..85102.04 rows=198155 width=12)
Group Key: aid
-> Sort (cost=81634.33..82129.72 rows=198155 width=8)
Sort Key: aid
-> Seq Scan on pgbench_accounts (cost=0.00..61487.89 rows=198155
width=8)
Filter: (filler ~~ '%foo%'::text)
(6 rows)
PFA patch to correct the same.
Regards,
Rushabh Lathia
www.EnterpriseDB.com
Attachment | Content-Type | Size |
---|---|---|
fix_startup_cost_cost_agg.patch | application/x-download | 684 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2017-03-02 12:48:20 | Re: Partitioned tables and relfilenode |
Previous Message | Craig Ringer | 2017-03-02 12:23:50 | Re: logical decoding of two-phase transactions |