Thread: pgsql: Teach planner about more monotonic window functions
Teach planner about more monotonic window functions 9d9c02ccd introduced runConditions for window functions to allow monotonic window function evaluation to be made more efficient when the window function value went beyond some value that it would never go back from due to its monotonic nature. That commit added prosupport functions to inform the planner that row_number(), rank(), dense_rank() and some forms of count(*) were monotonic. Here we add support for ntile(), cume_dist() and percent_rank(). Reviewed-by: Melanie Plageman Discussion: https://postgr.es/m/CAApHDvqR+VqB8s+xR-24bzJbU8xyFrBszJ17qKgECf7cWxLCaA@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/456fa635a909ee36f73ca84d340521bd730f265f Modified Files -------------- src/backend/utils/adt/windowfuncs.c | 30 ++++++++++++++++++++++++++++++ src/test/regress/expected/window.out | 26 ++++++++++++++------------ src/test/regress/sql/window.sql | 10 ++++++---- 3 files changed, 50 insertions(+), 16 deletions(-)
On 2023-Jan-27, David Rowley wrote: > Teach planner about more monotonic window functions > > 9d9c02ccd introduced runConditions for window functions to allow > monotonic window function evaluation to be made more efficient when the > window function value went beyond some value that it would never go back > from due to its monotonic nature. That commit added prosupport functions > to inform the planner that row_number(), rank(), dense_rank() and some > forms of count(*) were monotonic. Here we add support for ntile(), > cume_dist() and percent_rank(). I think this commit missed a catversion bump. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
On Sat, 28 Jan 2023 at 08:12, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote: > I think this commit missed a catversion bump. I'd agree with you if the patch had added any new prosupport functions, but all it did was modify 3 existing ones. I'm unaware of the reason why a catversion bump would be required for doing that. David