From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Hadi Moshayedi <hadi(at)moshayedi(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kevin Grittner <kgrittn(at)ymail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "mark(dot)kirkwood(at)catalyst(dot)net(dot)nz" <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz> |
Subject: | Re: Improving avg performance for numeric |
Date: | 2013-07-08 14:05:31 |
Message-ID: | CAFj8pRDvpB4NJkUx+iTxVfMcxD3O9KxB6vYTAffh5kdicoDfEw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
I am testing your code, and It increase speed of sum about 24% faster
then original implementation.
But I am surprise of AVG speed - it should have same speed like sum in
new implementation, but it is 2x slower, than sum - what signalize
some strange and there is used wrong transition function
I am sending fixed version
postgres=# create table bubu(a int, b float, c numeric);
CREATE TABLE
postgres=# insert into bubu select i, i+1, i+1.122 from
generate_series(1,1000000) g(i);
INSERT 0 1000000
After fixing a speed of sum and avg for numeric is similar
postgres=# select avg(c) from bubu;
avg
---------------------
500001.622000000000
(1 row)
Time: 228.483 ms
postgres=# select sum(c) from bubu;
sum
------------------
500001622000.000
(1 row)
Time: 222.791 ms
Regards
Pavel
2013/7/8 Hadi Moshayedi <hadi(at)moshayedi(dot)net>:
> I am attaching the updated the patch, which also fixes a bug which
> caused one of the regression tests failed.
>
> I'll subscribe this patch to the commitfest in the next hour.
>
> Can you please review the patch?
>
> Thanks,
> -- Hadi
Attachment | Content-Type | Size |
---|---|---|
numeric-optimize-v4.patch | application/octet-stream | 53.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2013-07-08 14:19:04 | Re: sepgsql and materialized views |
Previous Message | Amit Kapila | 2013-07-08 13:54:26 | Re: Review: Patch to compute Max LSN of Data Pages |