public inbox for [email protected]
help / color / mirror / Atom feedRe: Unfortunate pushing down of expressions below sort
2+ messages / 1 participants
[nested] [flat]
* Re: Unfortunate pushing down of expressions below sort
@ 2026-02-06 00:13 Tom Lane <[email protected]>
2026-02-06 01:02 ` Re: Unfortunate pushing down of expressions below sort Tom Lane <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Tom Lane @ 2026-02-06 00:13 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: pgsql-hackers; David Rowley <[email protected]>
Andres Freund <[email protected]> writes:
> We push down expressions below a sort node, even though they could be
> evaluated above.
Yeah. That's a hangover from an ancient decision that sort/limit
would always be applied at the top of the plan tree. I'm too
lazy to check the details right now, but I think we already relaxed
that in some cases (or maybe it was about evaluating stuff
before/after GROUP BY?).
> That can very substantially increase the space needed for the
> sort.
Could decrease it too, eg if what you are outputting is
md5(some-wide-column). Not sure we are smart enough to tell
which way is better.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Unfortunate pushing down of expressions below sort
2026-02-06 00:13 Re: Unfortunate pushing down of expressions below sort Tom Lane <[email protected]>
@ 2026-02-06 01:02 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2026-02-06 01:02 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: pgsql-hackers; David Rowley <[email protected]>
I wrote:
> Yeah. That's a hangover from an ancient decision that sort/limit
> would always be applied at the top of the plan tree. I'm too
> lazy to check the details right now, but I think we already relaxed
> that in some cases (or maybe it was about evaluating stuff
> before/after GROUP BY?).
Ah, right: see make_sort_input_target() and its very extensive
comment in planner.c. I wonder why that didn't trigger in
your example.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-02-06 01:02 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-02-06 00:13 Re: Unfortunate pushing down of expressions below sort Tom Lane <[email protected]>
2026-02-06 01:02 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox