Teach planner about more monotonic window functions
authorDavid Rowley <drowley@postgresql.org>
Fri, 27 Jan 2023 03:08:41 +0000 (16:08 +1300)
committerDavid Rowley <drowley@postgresql.org>
Fri, 27 Jan 2023 03:08:41 +0000 (16:08 +1300)
commit456fa635a909ee36f73ca84d340521bd730f265f
treeb987b3e29dd74e2382bc0a257d0cee76c5993556
parent783d8abc3b63267194ca21b679caf8d152b93358
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
src/backend/utils/adt/windowfuncs.c
src/test/regress/expected/window.out
src/test/regress/sql/window.sql