Re: "pivot aggregation" with a patched intarray - Mailing list pgsql-hackers

From Ali Akbar
Subject Re: "pivot aggregation" with a patched intarray
Date
Msg-id CACQjQLq39HZ-0LqPrusW+i8Oghg3aN4tm-8i0GYs6HYerY1vvQ@mail.gmail.com
Whole thread Raw
In response to Re: "pivot aggregation" with a patched intarray  (Marc Mamin <M.Mamin@intershop.de>)
Responses Re: "pivot aggregation" with a patched intarray
List pgsql-hackers
2014-06-05 17:18 GMT+07:00 Marc Mamin <M.Mamin@intershop.de>:
> I'm thinking about adding a final function to my aggregate that would replace zero values will nulls,
> hence transforming the intarray into a standard int[], possibly with nullbitmap and a lowerbound that can be > 1.
> This will probably degrade the performance considerably, but may reduce the size of the end result for spare data and
nottoo small integers...
 
> Performances should greatly depend on the data distribution and order as they influence the number of palloc.
> My first tests shown as well better and poorer results.
>
> My target is not to get better performances at the first place, but to get a pivot structure in an early aggregation
stage.

Usually for pivot, i use crosstab function from tablefunc
(http://www.postgresql.org/docs/9.4/static/tablefunc.html#AEN158550).
If your patch doesn't perform better, it's more easier to just use
crosstab. For storing it efficiently, the result can be transformed
into array manually.

PS: as Michael Paquier said above, its better if you could send the
patch in the .patch file format (see:
https://wiki.postgresql.org/wiki/Working_with_GIT).

-- 
Ali Akbar



pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Allowing join removals for more join types
Next
From: Noah Misch
Date:
Subject: Re: tests for client programs