Re: Remove WindowClause PARTITION BY items belonging to redundant pathkeys

2023-07-02 Thread David Rowley
On Mon, 12 Jun 2023 at 20:20, Richard Guo wrote: > So now the v2 patch looks good to me. Thank you for reviewing this. I've just pushed the patch. David

Re: Remove WindowClause PARTITION BY items belonging to redundant pathkeys

2023-06-12 Thread Richard Guo
On Mon, Jun 12, 2023 at 12:06 PM David Rowley wrote: > On Fri, 9 Jun 2023 at 20:57, Richard Guo wrote: > > On Fri, Jun 9, 2023 at 8:13 AM David Rowley > wrote: > >> It might be possible to make adjustments in nodeWindowAgg.c to have > >> the equality checks come out as true when there is no ORD

Re: Remove WindowClause PARTITION BY items belonging to redundant pathkeys

2023-06-11 Thread David Rowley
On Fri, 9 Jun 2023 at 20:57, Richard Guo wrote: > > On Fri, Jun 9, 2023 at 8:13 AM David Rowley wrote: >> It might be possible to make adjustments in nodeWindowAgg.c to have >> the equality checks come out as true when there is no ORDER BY. >> update_frameheadpos() is one location that would need

Re: Remove WindowClause PARTITION BY items belonging to redundant pathkeys

2023-06-09 Thread Richard Guo
On Fri, Jun 9, 2023 at 8:13 AM David Rowley wrote: > After looking again at nodeWindowAgg.c, I think it might be possible > to do a bit more work and apply this to ORDER BY items too. Without > an ORDER BY clause, all rows in the partition are peers of each other, > and if the ORDER BY column is

Re: Remove WindowClause PARTITION BY items belonging to redundant pathkeys

2023-06-08 Thread David Rowley
Thank you for having a look at this. On Thu, 8 Jun 2023 at 21:11, Richard Guo wrote: > > On Thu, Jun 8, 2023 at 7:37 AM David Rowley wrote: >> >> What the attached patch does is process each WindowClause and removes >> any items from the PARTITION BY clause that are columns or expressions >> rel

Re: Remove WindowClause PARTITION BY items belonging to redundant pathkeys

2023-06-08 Thread Richard Guo
On Thu, Jun 8, 2023 at 7:37 AM David Rowley wrote: > What the attached patch does is process each WindowClause and removes > any items from the PARTITION BY clause that are columns or expressions > relating to redundant PathKeys. > > Effectively, this allows the nodeWindowAgg.c code which stops >

Remove WindowClause PARTITION BY items belonging to redundant pathkeys

2023-06-07 Thread David Rowley
Recently Markus Winand pointed out to me that the PG15 changes made in [1] to teach the query planner about monotonic window functions improved the situation for PostgreSQL on his feature/optimization timeline for PostgreSQL. These can be seen in [2]. Unfortunately, if you look at the timeline in