Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wQImt-001Q8S-05 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 May 2026 05:51:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wQImq-00CRZA-2v for pgsql-hackers@arkaria.postgresql.org; Fri, 22 May 2026 05:51:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wQImq-00CRYp-22 for pgsql-hackers@lists.postgresql.org; Fri, 22 May 2026 05:51:09 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wQImp-00000000qXh-1caT for pgsql-hackers@lists.postgresql.org; Fri, 22 May 2026 05:51:09 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4891c00e7aeso50218625e9.2 for ; Thu, 21 May 2026 22:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779429066; x=1780033866; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=kJJULLUCYDVBJtUg9lVJL3HuqojgQ818Un6PpItjEI4=; b=RZgIlQsYUsqYBXVitP5Yy3FyLdiHF4Vpn2+dtUHXpu8ZIxIltLtNmQ+Q9D+arxib5Z 6LaYS/UfeYGNDMGuKaM+Ly1axIBwOxnIml9ObauY3nF3LL754gwrQOVE/zq+DmiKlOQX vgFxoTgidZ+De3cYRO67bP4OR2iJ6v+f4GH4CV9YsPxjptNcMhZTKmSsLF0r8LU75m09 RjLaZYejqSbhrccrMUtVd/adHJ0n/HCJrmlIWMVTDzq+HqgRRsIpThqrZqDikCoFujtf 6LmUMt+RCzyD7nnHqqFYT9Pk/dQE9oee1UIVGOW/tb8ghawfE7rhZBsJo+aMbRXO/2Bs ENGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779429066; x=1780033866; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kJJULLUCYDVBJtUg9lVJL3HuqojgQ818Un6PpItjEI4=; b=Is4YKUzhmifmEKGBY4z2ithgRJFUa0523K3/Rc9RgVaA1oSq7MFE0EQFYdKye7dhAR 146ecnpTVJiMxbYleyhhIpCh3bctBQHmxe0W64iZUAY4kXIPPql12pehslvzyCHKh2bG U9ueB5XC72GYVhw35EJOuv92hGUj16Pfyw4DtHIJ98bnz0ENAF9vHaIkKq5dYDVS6Cgm fP1jZs4nEf1A4jITilIU25Yf1fER5ACJFCTDveEJGDIcR+nx823LwRuR8wHNcmosfOsv XfHUqQBgDsASBahGJSXLmLjals4k/go5FicPU7yK7RKoMJvGm3+9TAe0m5qQ/qBdABxL +NKg== X-Forwarded-Encrypted: i=1; AFNElJ8NWSHFcOiBdLQRYn6jmsUxbJNtLakT0NWYYRQhW8MCw0jeKzf5gbeCVx3/WgTUEZnVk9GFlqSJAsC6wu7G@lists.postgresql.org X-Gm-Message-State: AOJu0YwM3OQ8QUXlw6fJEaeWAccChh3FjHpTfOyiFG0WUaB3H2hgSmh+ 99/UNyKiXc2NDVt9217NNFUL5xAWqxfxo11G5UoVCmNb7ORrpkAMSnvh X-Gm-Gg: Acq92OHmCLgpiPpbYocFS34CAsokYf7FpjCSPsCMl8XXaxdaieQTa8Jd7rdEfdD2mRq 8A3PW2YKA+wqMEVFj/vBR29d3XCZQEr4zTIgxTL/TGstrKMmpe2R1qq2AAj/JHcSy3gz5EOwsEd 3N8B0rL8iu5d8uAbTQ8eJki1PGS4LN1vlZeb/gXMiWQksjm7aWpWiYhPngbvh8WRS+Bs/DFAR3z qFX7pR8mL3FZxhCQ6jVFsTgu741lh4c0kf8ZzcrwF4aAG3fcVyY+TedJn6t8Ctbk0/so3ClgYgK 9WSsDTeYo89swcdnplaKzh500ELYyo8JNuGtgw3YeQl5n+T2K+e9u13ra2LSZUp8Px6aX/yR/0f HigpnoG+vbDBuic1W+6oCar2K91I0ujTfBPYJqaFVb1FddGwPW906B5DxIIFel5pVSDqXZFw7aA uJaLPllRBwiF7fh1T3eqL97465IkQ5IQb/5NGQ X-Received: by 2002:a05:600c:4ecb:b0:490:44eb:c1e9 with SMTP id 5b1f17b1804b1-49044ebc303mr16174745e9.26.1779429065557; Thu, 21 May 2026 22:51:05 -0700 (PDT) Received: from [192.168.15.82] ([80.251.191.198]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490417a3be1sm13886385e9.3.2026.05.21.22.51.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2026 22:51:04 -0700 (PDT) Message-ID: Date: Fri, 22 May 2026 07:51:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Try a presorted outer path when referenced by an ORDER BY prefix To: Zsolt Parragi , pgsql-hackers@lists.postgresql.org References: <19a9265c-c441-4a43-bc0d-dac533438da0@gmail.com> <67352ee9-fada-4253-a73d-d0f101dfb424@gmail.com> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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