Re: Avoid extra Sort nodes between WindowAggs when sorting can be reused
Daniel Gustafsson <daniel@yesql.se>
From: Daniel Gustafsson <daniel@yesql.se>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-07-24T22:37:06Z
Lists: pgsql-hackers
Attachments
- window_prefix_sort-v5.patch (application/octet-stream) patch v5
> On 3 Jul 2018, at 12:24, Masahiko Sawada <sawada.mshk@gmail.com> wrote: > Thank you for updating the patch. Thanks for reviewing! > Hmm, this is missing the eqop fields of SortGroupClause. I haven't > tested yet but does the similar degradation happen if two > SortGroupCaluses have different eqop and the same other values? I wasn’t able to construct a case showing this, but I also think you’re right. Do you have an idea of a query that can trigger a regression? The attached patch adds a stab at this, but I’m not sure if it’s the right approach. > The source code comments for common_prefix_cmp() function and > WindowClauseSortNode struct is needed. Fixed. > + from empsalary; > > I think it's better to change "from empsalary" to "FROM empsalary" for > consistency with other code. Yes, that was a silly oversight. Fixed. cheers ./daniel
Commits
-
Order active window clauses for greater reuse of Sort nodes.
- 728202b63cdc 12.0 landed