From: | Vik Fearing <vik(at)postgresfriends(dot)org> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Erwin Brandstetter <brsaweda(at)gmail(dot)com> |
Subject: | Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options |
Date: | 2022-10-22 14:03:24 |
Message-ID: | 0e4fcd7b-5711-d2e5-7a21-bae8e41f4811@postgresfriends.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 10/20/22 22:02, David Rowley wrote:
> On Thu, 13 Oct 2022 at 13:34, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>> So it looks like the same can be done for rank() and dense_rank() too.
>> I've added support for those in the attached.
>
> The attached adds support for percent_rank(), cume_dist() and ntile().
Shouldn't it be able to detect that these two windows are the same and
only do one WindowAgg pass?
explain (verbose, costs off)
select row_number() over w1,
lag(amname) over w2
from pg_am
window w1 as (order by amname),
w2 as (w1 rows unbounded preceding)
;
QUERY PLAN
-----------------------------------------------------------------
WindowAgg
Output: (row_number() OVER (?)), lag(amname) OVER (?), amname
-> WindowAgg
Output: amname, row_number() OVER (?)
-> Sort
Output: amname
Sort Key: pg_am.amname
-> Seq Scan on pg_catalog.pg_am
Output: amname
(9 rows)
--
Vik Fearing
From | Date | Subject | |
---|---|---|---|
Next Message | Matheus Alcantara | 2022-10-22 16:49:30 | Interesting areas for beginners |
Previous Message | Tomas Vondra | 2022-10-22 13:47:43 | Re: Missing update of all_hasnulls in BRIN opclasses |