Thread

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

    Andrei Lepikhov <lepihov@gmail.com> — 2026-05-22T05:51:04Z

    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