public inbox for [email protected]
help / color / mirror / Atom feedFrom: Ankit Kumar Pandey <[email protected]>
To: David Rowley <[email protected]>
Cc: pghackers <[email protected]>
Subject: Re: Todo: Teach planner to evaluate multiple windows in the optimal order
Date: Wed, 4 Jan 2023 17:37:46 +0530
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAApHDvq=g2=ny59f1bvwRVvupsgPHK-KjLPBsSL25fVuGZ4idQ@mail.gmail.com>
References: <[email protected]>
<CAApHDvp=r1LnEKCmWCYaruMPL-jP4j_sdc8yeFYwaDT1ac5GsQ@mail.gmail.com>
<[email protected]>
<CAApHDvq=g2=ny59f1bvwRVvupsgPHK-KjLPBsSL25fVuGZ4idQ@mail.gmail.com>
On 04/01/23 09:32, David Rowley wrote:
>
> It looks like that works by accident. I see no mention of this either
> in the comments or in [1].
This kind of troubles me because function name
/select_active_windows///doesn't tell me if its only job is
to reorder window clauses for optimizing sort. From code, I don't see it
doing anything else either.
> If we don't have one already, then we should likely add a regression
> test that ensures that this remains true. Since it does not seem to
> be documented in the code anywhere, it seems like something that could
> easily be overlooked if we were to ever refactor that code.
>
I don't see any tests in windows specific to sorting operation (and in
what order). I will add those.
Also, one thing, consider the following query:
explain analyze select row_number() over (order by a,b),count(*) over
(order by a) from abcd order by a,b,c;
In this case, sorting is done on (a,b) followed by incremental sort on c
at final stage.
If we do just one sort: a,b,c at first stage then there won't be need to
do another sort (incremental one).
Now, I am not sure if which one would be faster: sorting (a,b,c) vs
sort(a,b) + incremental sort(c)
because even though datum sort is fast, there can be n number of combos
where we won't be doing that.
I might be looking at extreme corner cases though but still wanted to share.
--
Regards,
Ankit Kumar Pandey
view thread (6+ 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]
Subject: Re: Todo: Teach planner to evaluate multiple windows in the optimal order
In-Reply-To: <[email protected]>
* 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