Jeff Janes <jeff.janes@gmail.com> writes:
> On Sun, Nov 20, 2016 at 2:45 AM, Pavel Stehule <pavel.stehule@gmail.com>
> wrote:
>> you can use composite type instead array too.
> I tried a composite type of (flag int, value anyelement) but you can't use
> anyelement in a composite type. So the aggregate function couldn't be
> polymorphic. Or, that was my conclusion after making a few attempts. Maybe
> I need to give on polymorphism if I want to get performance?
I would bet on a composite type being as slow or slower than the array
solution. You could do a quick test with a non-polymorphic definition
just to see, but I doubt it's a promising avenue.
regards, tom lane