Re: Function array_agg(array)

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Ali Akbar <the(dot)apaan(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-26 18:38:08
Message-ID: CAFj8pRBMKP3c9eU42J3nKmiNRHOP2+PAvpDO1gqdQThO0PF+Yg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

My idea is using new ArrayBuilder optimized for building multidimensional
arrays with own State type. I think so casting to ArrayBuildState is base
of our problems, so I don't would to do. Code in array_agg_* is simple,
little bit more complex code is in nodeSubplan.c. Some schematic changes
are in attachments.

Regards

Pavel

2014-10-25 15:58 GMT+02:00 Ali Akbar <the(dot)apaan(at)gmail(dot)com>:

> 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
nodeSubplan.c text/x-csrc 1.1 KB
image/gif 47.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2014-10-26 18:40:09 Re: TAP test breakage on MacOS X
Previous Message Tom Lane 2014-10-26 16:29:55 Re: TAP test breakage on MacOS X