Re: sum(int4)/sum(int2) improvement

From: Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: sum(int4)/sum(int2) improvement
Date: 2005-09-02 12:09:55
Message-ID: PIEMIKOOMKNIJLLLBCBBAEPKCKAA.a_ogawa@hi-ho.ne.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Matt Miller 2005-09-02 14:34:50 Re: PL/pgSQL: EXCEPTION NOSAVEPOINT
Previous Message Koichi Suzuki 2005-09-02 10:36:42 Re: A couple of patches for PostgreSQL 64bit support