Re: [PATCH] distinct aggregates within a window function WIP - Mailing list pgsql-hackers

From Thomas Kellerer
Subject Re: [PATCH] distinct aggregates within a window function WIP
Date
Msg-id 17d78132-6594-3bce-8f17-7184b916341f@gmx.net
Whole thread Raw
In response to Re: [PATCH] distinct aggregates within a window function WIP  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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






pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Add pg_file_sync() to adminpack
Next
From: Krasiyan Andreev
Date:
Subject: Re: [PATCH] distinct aggregates within a window function WIP