Re: Printing window function OVER clauses in EXPLAIN

2025-03-11 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > On 2025-Mar-09, Tom Lane wrote: >> David Rowley writes: >>> What are your thoughts on being a bit more brief with the naming and >>> just prefix with "w" instead of "window"? >> OK by me, any objections elsewhere? > WFM. Here's a hopefully-final v3 tha

Re: Printing window function OVER clauses in EXPLAIN

2025-03-11 Thread Tom Lane
David Rowley writes: > What are your thoughts on being a bit more brief with the naming and > just prefix with "w" instead of "window"? Looking at window.out, I see > that the EXPLAIN output does become quite a bit wider than before. I > favour the idea of saving a bit of space. There is an examp

Re: Printing window function OVER clauses in EXPLAIN

2025-03-11 Thread Tom Lane
David Rowley writes: > The only minor points I noted down while reviewing were 1) > name_active_windows()'s newname variable could be halved in size and, > 2) explain.sql's new test could name the window "w1" instead of "w" to > exercise the name selection code a bit better. Both are minor points,

Re: Printing window function OVER clauses in EXPLAIN

2025-03-10 Thread David Rowley
On Tue, 11 Mar 2025 at 05:18, Tom Lane wrote: > Here's a hopefully-final v3 that makes the two changes discussed. > Now with a draft commit message, too. Looks good to me. The only minor points I noted down while reviewing were 1) name_active_windows()'s newname variable could be halved in size

Re: Printing window function OVER clauses in EXPLAIN

2025-03-09 Thread Álvaro Herrera
On 2025-Mar-09, Tom Lane wrote: > David Rowley writes: > > What are your thoughts on being a bit more brief with the naming and > > just prefix with "w" instead of "window"? Looking at window.out, I see > > that the EXPLAIN output does become quite a bit wider than before. I > > favour the idea o

Re: Printing window function OVER clauses in EXPLAIN

2025-03-09 Thread David Rowley
On Mon, 10 Mar 2025 at 11:19, Tom Lane wrote: > OK, here's v2 done like that. I do like this output better. > I backed off the idea of putting the WindowClause as such > into the plan, partly because I didn't feel like debugging > the setrefs.c problem that David discovered upthread. > This way d

Re: Printing window function OVER clauses in EXPLAIN

2025-03-09 Thread Tom Lane
I wrote: > I'll go try to code this up. OK, here's v2 done like that. I do like this output better. I backed off the idea of putting the WindowClause as such into the plan, partly because I didn't feel like debugging the setrefs.c problem that David discovered upthread. This way does require a bi

Re: Printing window function OVER clauses in EXPLAIN

2025-03-09 Thread David Rowley
On Mon, 10 Mar 2025 at 14:13, Tom Lane wrote: > Hmm, OK. Do you think it could be sensible to put Run Condition > before Filter, then? On the same grounds of "keeping related > things together", it could be argued that Run Condition is > related to the Window property. Also, the Run Condition a

Re: Printing window function OVER clauses in EXPLAIN

2025-03-09 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > Would it be possible and make sense to use notation of explicit WINDOW > clauses, for cases where multiple window functions invoke identical > window definitions? There's something to be said for that. We would have to assign made-up names to windows tha

Re: Printing window function OVER clauses in EXPLAIN

2025-03-09 Thread Álvaro Herrera
Hello Would it be possible and make sense to use notation of explicit WINDOW clauses, for cases where multiple window functions invoke identical window definitions? I'm thinking of something like explain verbose SELECT empno, depname, row_number() OVER testwin rn, rank() OVER tes

Re: Printing window function OVER clauses in EXPLAIN

2025-03-08 Thread David G. Johnston
On Sat, Mar 8, 2025 at 6:15 PM David Rowley wrote: > On Sun, 9 Mar 2025 at 10:39, Tom Lane wrote: > > One thing that puzzled me a bit is that many of the outputs > > show "ROWS UNBOUNDED PRECEDING" in window functions where that > > definitely wasn't in the source query. Eventually I realized >

Re: Printing window function OVER clauses in EXPLAIN

2025-03-08 Thread David Rowley
On Sun, 9 Mar 2025 at 10:39, Tom Lane wrote: > One thing that puzzled me a bit is that many of the outputs > show "ROWS UNBOUNDED PRECEDING" in window functions where that > definitely wasn't in the source query. Eventually I realized > that that comes from window_row_number_support() and cohorts