Re: [PATCH] distinct aggregates within a window function WIP

From: Thomas Kellerer <shammat(at)gmx(dot)net>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] distinct aggregates within a window function WIP
Date: 2020-01-13 14:49:51
Message-ID: 17d78132-6594-3bce-8f17-7184b916341f@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane schrieb am 13.01.2020 um 15:19:

> what it is is attaching DISTINCT to a window function itself.
> I'd still ask whether it's well-defined though, or even minimally
> sensible. Window functions are generally supposed to produce one
> row per input row --- how does that square with the implicit row
> merging of DISTINCT? They're also typically row-order-sensitive
> --- how does that work with DISTINCT? Also, to the extent that
> this is sensible, can't you get the same results already today
> with appropriate use of window framing options?

I find the example using array_agg() and cumulative window functions a
bit confusing as well, but I think there are situations where having this
is really helpful, e.g.:

count(distinct some_column) over (partition by something)

I know it's not an argument, but Oracle supports this and porting
queries like that from Oracle to Postgres isn't really fun.

Thomas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Krasiyan Andreev 2020-01-13 15:22:29 Re: [PATCH] distinct aggregates within a window function WIP
Previous Message Julien Rouhaud 2020-01-13 14:39:32 Re: Add pg_file_sync() to adminpack