public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andy Fan <[email protected]>
To: David Rowley <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Zhihong Yu <[email protected]>
Cc: PostgreSQL Developers <[email protected]>
Subject: Re: Window Function "Run Conditions"
Date: Tue, 5 Apr 2022 20:59:10 +0800
Message-ID: <CAKU4AWrzzC4GCe2Mo_fYxc_SY=Ss1i0x-AEMjP_mxZYe6aMw=w@mail.gmail.com> (raw)
In-Reply-To: <CAApHDvrU132PxjuLakFrQhjR_b40LHAqhCzk-q2iGOST+-6dCw@mail.gmail.com>
References: <CAApHDvqvp3At8++yF8ij06sdcoo1S_b2YoaT9D4Nf+MObzsrLQ@mail.gmail.com>
<CAApHDvrxxkc9dgoRJUHy6U+XmGjSXRF=fQ-_U1-EvzTjCA9XKw@mail.gmail.com>
<CALNJ-vSRgdOsMx-oiOZcMJzcxoRCo0nJr=U8us4eJR8R6n9ZtA@mail.gmail.com>
<CAApHDvpiAUmUMTETAua8XCLFJiFhsZkCwuiW50KDvehexA-SLA@mail.gmail.com>
<CAKU4AWq5MB_inrYUwPQYXU1fCopCwgYK53N2uYGYFBH3QEhZMA@mail.gmail.com>
<CAApHDvp8PSY3GJXNzzrBPJtzRgQ-C85OPy-bypFGmwaT3AjCjQ@mail.gmail.com>
<CAKU4AWrWzXFuGW4d3YTu=TJSWQKTB=J3E8S_5zyuLNR7npomAA@mail.gmail.com>
<CAApHDvqtwE4bZxAdk+LQgVkKM+Em-sHybON_OX4YbFs+sQUKWg@mail.gmail.com>
<CAApHDvoe=MqH66pDWynUtdammYHiB8m+zE7LvL_CGuxm1yK4BQ@mail.gmail.com>
<CAApHDvpYYndDJfGCmNA-o60VLb8D9OB1deh-qcsTiDjxVcFg_w@mail.gmail.com>
<[email protected]>
<CAApHDvp+rzxGh58hc3Fmr90PR-M=JOg96X0B5tfvY4pTKqNa3g@mail.gmail.com>
<CAKU4AWoiqPd_DdOA_0PWZ_e9cV6e1yP6F0VmxaLjedwTWQtBJA@mail.gmail.com>
<CAKU4AWpmDGMxQ3nJfj=awQAgcL-jP2p67MtpiHFZX77NaZ2hxQ@mail.gmail.com>
<CAApHDvrU132PxjuLakFrQhjR_b40LHAqhCzk-q2iGOST+-6dCw@mail.gmail.com>
On Tue, Apr 5, 2022 at 7:49 PM David Rowley <[email protected]> wrote:
> On Tue, 5 Apr 2022 at 19:38, Andy Fan <[email protected]> wrote:
> > 1. We can do more on PASSTHROUGH, we just bypass the window function
> > currently, but IIUC we can ignore all of the following tuples in
> current partition
> > once we go into this mode. patch 0001 shows what I mean.
>
> Yeah, there is more performance to be had than even what you've done
> there. There's no reason really for spool_tuples() to do
> tuplestore_puttupleslot() when we're not in run mode.
>
Yeah, this is a great idea.
The attached should give slightly more performance. I'm unsure if
> there's more that can be done for window aggregates, i.e.
> eval_windowaggregates()
>
> I'll consider the idea about doing all the filtering in
> nodeWindowAgg.c. For now I made find_window_run_conditions() keep the
> qual so that it's still filtered in the subquery level when there is a
> PARTITION BY clause. Probably the best way would be to make
nodeWindowAgg.c just loop with a for(;;) loop. I'll need to give it
> more thought. I'll do that in the morning.
>
>
I just finished the planner part review and thought about the
multi activeWindows
cases, I think passthrough mode should be still needed but just for multi
activeWindow cases, In the passthrough mode, we can not discard the tuples
in the same partition. Just that PARTITION BY clause should not be the
requirement
for passthrough mode and we can do such optimization. We can discuss
more after your final decision.
And I would suggest the below fastpath for this feature.
@@ -2535,7 +2535,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo
*rel,
* if it happens to reference a window
function. If so then
* it might be useful to use for the
WindowAgg's runCondition.
*/
- if (check_and_push_window_quals(subquery,
rte, rti, clause))
+ if (!subquery->hasWindowFuncs ||
check_and_push_window_quals(subquery, rte, rti, clause))
{
/*
* It's not a suitable window run
condition qual or it is,
--
Best Regards
Andy Fan
view thread (12+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Window Function "Run Conditions"
In-Reply-To: <CAKU4AWrzzC4GCe2Mo_fYxc_SY=Ss1i0x-AEMjP_mxZYe6aMw=w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox