public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Andres Freund <[email protected]>
Cc: [email protected]
Cc: David Rowley <[email protected]>
Subject: Re: Unfortunate pushing down of expressions below sort
Date: Thu, 05 Feb 2026 19:13:09 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <qddu2agmbiadpqkavqlamccrqxg6rm64sdq6q7ihpyndyfim6k@2dpox3fupa2g>
References: <qddu2agmbiadpqkavqlamccrqxg6rm64sdq6q7ihpyndyfim6k@2dpox3fupa2g>

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






view thread (2+ 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: Unfortunate pushing down of expressions below sort
  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