Re: sum(int4)/sum(int2) improvement - Mailing list pgsql-patches

From Atsushi Ogawa
Subject Re: sum(int4)/sum(int2) improvement
Date
Msg-id PIEMIKOOMKNIJLLLBCBBAEPKCKAA.a_ogawa@hi-ho.ne.jp
Whole thread Raw
In response to Re: sum(int4)/sum(int2) improvement  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> I went back and looked at your AllocSetReset patch from last May, and
> liked it better on second consideration.

> I'll fix up the old patch and apply it.  I think that's a better answer
> than kluging up the aggregate functions themselves.

Thanks. I also think this fix is better. It speeds up hash join etc. besides
sum(int4) and sum(int2).

Example:
- SQL
select b.bid, count(*)
from accounts a, branches b
where a.bid = b.bid
group by b.bid;

- Query Plan
HashAggregate  (cost=23198.06..23198.08 rows=5 width=4)
  ->  Hash Join  (cost=1.06..20698.06 rows=500000 width=4)
        Hash Cond: ("outer".bid = "inner".bid)
        ->  Seq Scan on accounts a  (cost=0.00..13197.00 rows=500000
width=4)
        ->  Hash  (cost=1.05..1.05 rows=5 width=4)
              ->  Seq Scan on branches b  (cost=0.00..1.05 rows=5 width=4)

- Result
 original: 2.416s
 patched:  2.286s

regards,

--- Atsushi Ogawa


pgsql-patches by date:

Previous
From: Koichi Suzuki
Date:
Subject: Re: A couple of patches for PostgreSQL 64bit support
Next
From: Darcy Buskermolen
Date:
Subject: Note that spaces between QUOTE and DELIMITER are included in the field during CVS COPY.