Re: Try a presorted outer path when referenced by an ORDER BY prefix

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Try a presorted outer path when referenced by an ORDER BY prefix
Date: 2026-05-22 05:51:04
Message-ID: de022aaa-057c-4f06-9b2b-10f45a11ac04@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13/05/2026 16:03, Zsolt Parragi wrote:
> + else if (jointype == JOIN_RIGHT)
> + ExecSetTupleBound(tuples_needed, innerPlanState(child_node));
>
> Is this branch reachable? If I follow the code correctly, it can't
> happen with create_nestloop_path.

RIGHT NL seems like nonsense to me. This code stays here just to remind me to
add a check in the next version, if the community is interested.

>
> pg_plan_advice also has test failures with the patch applied.

We already talked about this in the main thread for pg_plan_advice. Now, it is
unavoidable because pg_plan_advice limits optimisations that expand the planning
scope. Before, it was enough to use standard tools like create_seqscan_path and
add_path and provide a semantically correct plan. Now, every optimisation has to
meet pg_plan_advice's internal rules, which are much more restrictive.
I did not fix this test failure to highlight the unpleasant situation for
extension developers, but you can find the fix in the list [1].

[1]
https://www.postgresql.org/message-id/CAP53Pkw2Lw0bavkCR-ygmaGACBjwmY3Voq0Yhwo9rVOBWxQuyw@mail.gmail.com

--
regards, Andrei Lepikhov,
pgEdge

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-05-22 06:10:20 Re: effective_wal_level is not decreasing after using REPACK (CONCURRENTLY)
Previous Message Peter Smith 2026-05-22 05:30:12 Re: Support EXCEPT for TABLES IN SCHEMA publications