Skip site navigation (1) Skip section navigation (2)

Re: Review: listagg aggregate

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, "pgsql-hackers(at)postgresql(dot)org Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Review: listagg aggregate
Date: 2010-01-28 17:12:50
Message-ID: 162867791001280912g7fde68b0l9fecfa77cd81c3c2@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2010/1/28 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Thu, Jan 28, 2010 at 10:56 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>> On Thu, Jan 28, 2010 at 9:01 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>>>> simplest could not be a best. There have to be only a const
>>>> expression. But we have not possibility to check it in pg.
>>
>>> Well... that's an entirely arbitrary limitation.  I admit that it
>>> doesn't seem likely that someone would want to have a variable
>>> delimiter, but putting extra effort and code complexity into
>>> preventing it seems pointless.
>>
>> Yeah.  The real issue here is that in some cases you'd like to have
>> non-aggregated parameters to an aggregate, but SQL has no notation
>> to express that.
>
> Right.
>
>> I think Pavel's underlying complaint is that if the delimiter
>> argument isn't constant, then we're exposing an implementation
>> dependency in terms of just which values get separated by which
>> delimiters.  The most practical implementation seems to be that
>> the first-call delimiter isn't actually used at all, and on
>> subsequent calls the delimiter *precedes* the associated value,
>> which is a bit surprising given the order in which one writes
>> them.  Not sure if this is worth documenting though.  Those two
>> or three people who actually try it will figure it out soon enough.
>

ok - there is one query,

in 99.99% the second argument will be a constant. Can we use this
information and optimize function for this case?

The detoast on every row can take some percent from a performance.

Pavel

> Yeah, I'm thoroughly unworried about it.


>
> ...Robert
>

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-01-28 17:12:58
Subject: Re: Add on_trusted_init and on_untrusted_init to plperl [PATCH]
Previous:From: Robert HaasDate: 2010-01-28 17:09:08
Subject: Re: Streaming replication, and walsender during recovery

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group