Re: Function array_agg(array)

From: Ali Akbar <the(dot)apaan(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function array_agg(array)
Date: 2014-10-25 13:58:01
Message-ID: CACQjQLrhBsrTPReZMNt5SPJz8P2sWHDsWbi0NzkCmv-_x4B2xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> you can check it? We can test, how performance lost we get. As second
> benefit we can get numbers for introduction new optimized array builder
>

array_agg(anyarray) with deconstruct_array, unchanged accumArrayResult and
makeMdArrayResult:

> INSERT 0 1
> Time: 852,527 ms
> INSERT 0 1
> Time: 844,275 ms
> INSERT 0 1
> Time: 858,855 ms
> INSERT 0 1
> Time: 861,072 ms
> INSERT 0 1
> Time: 952,006 ms
> INSERT 0 1
> Time: 953,918 ms
> INSERT 0 1
> Time: 926,945 ms
> INSERT 0 1
> Time: 923,692 ms
> INSERT 0 1
> Time: 940,916 ms
> INSERT 0 1
> Time: 948,700 ms
> INSERT 0 1
> Time: 933,333 ms
> INSERT 0 1
> Time: 948,869 ms
> INSERT 0 1
> Time: 847,113 ms
> INSERT 0 1
> Time: 908,572 ms

Total: 12776.83

Avg: 912,63

with last patch (v10):

> INSERT 0 1
> Time: 643,339 ms
> INSERT 0 1
> Time: 608,010 ms
> INSERT 0 1
> Time: 610,465 ms
> INSERT 0 1
> Time: 613,931 ms
> INSERT 0 1
> Time: 616,466 ms
> INSERT 0 1
> Time: 634,754 ms
> INSERT 0 1
> Time: 683,566 ms
> INSERT 0 1
> Time: 656,665 ms
> INSERT 0 1
> Time: 630,096 ms
> INSERT 0 1
> Time: 607,564 ms
> INSERT 0 1
> Time: 610,353 ms
> INSERT 0 1
> Time: 626,816 ms
> INSERT 0 1
> Time: 610,450 ms
> INSERT 0 1
> Time: 614,342 ms
>

Total: 8842,7
> Avg: 631,6

It's 30% faster (i tried varlena element - text). I tried several times and
it's consistent in +/- 30%.

quick & dirty non-optimized patch and the test script attached.

Regards,
--
Ali Akbar

Attachment Content-Type Size
array_agg_anyarray_notoptimized_dirty.patch text/x-patch 20.7 KB
script.sql application/sql 4.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Karlsson 2014-10-25 14:38:41 [WIP Patch] Using 128-bit integers for sum, avg and statistics aggregates
Previous Message Peter Eisentraut 2014-10-25 13:22:30 Re: Getting rid of "accept incoming network connections" prompts on OS X