Improve EXPLAIN's display of window functions.
Up to now we just punted on showing the window definitions used
in a plan, with window function calls represented as "OVER (?)".
To improve that, show the window definition implemented by each
WindowAgg plan node, and reference their window names in OVER.
For nameless window clauses generated by "OVER (...)", assign
unique names w1, w2, etc.
In passing, re-order the properties shown for a WindowAgg node
so that the Run Condition (if any) appears after the Window
property and before the Filter (if any). This seems more
sensible since the Run Condition is associated with the Window
and acts before the Filter.
Thanks to David G. Johnston and Álvaro Herrera for design
suggestions.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/144530.1741469955@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8b1b342544b69b281ffd3aafe594aec629ec4d3c
Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 25 +-
src/backend/commands/explain.c | 117 +++++++-
src/backend/optimizer/plan/createplan.c | 39 +--
src/backend/optimizer/plan/planner.c | 51 ++++
src/backend/utils/adt/ruleutils.c | 150 ++++++++---
src/include/nodes/plannodes.h | 3 +
src/include/utils/ruleutils.h | 5 +
src/test/regress/expected/box.out | 14 +-
src/test/regress/expected/create_index_spgist.out | 42 +--
src/test/regress/expected/explain.out | 45 +++-
src/test/regress/expected/generated_virtual.out | 3 +-
src/test/regress/expected/groupingsets.out | 12 +-
src/test/regress/expected/partition_prune.out | 4 +-
src/test/regress/expected/polygon.out | 3 +-
src/test/regress/expected/select_parallel.out | 7 +-
src/test/regress/expected/sqljson.out | 18 +-
src/test/regress/expected/window.out | 308 +++++++++++++---------
src/test/regress/sql/explain.sql | 5 +
18 files changed, 598 insertions(+), 253 deletions(-)