Re: Unfortunate pushing down of expressions below sort

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: Unfortunate pushing down of expressions below sort
Date: 2026-02-06 01:02:31
Message-ID: 1674012.1770339751@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2026-02-06 01:36:56 Re: client_connection_check_interval default value
Previous Message Jeremy Schneider 2026-02-06 01:02:05 Re: client_connection_check_interval default value