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 1w58ex-002w5W-2j for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 20:47:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w58ew-008qeB-0v for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Mar 2026 20:47:30 +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 1w58ev-008qe3-2y for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 20:47:30 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w58et-00000000wUS-2HXC for pgsql-hackers@lists.postgresql.org; Tue, 24 Mar 2026 20:47:30 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-666f646f5cfso409628a12.1 for ; Tue, 24 Mar 2026 13:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774385245; cv=none; d=google.com; s=arc-20240605; b=hfXGuMdOLG2b1Qu/hSE8jlK1zzSJZ/Ra4JB0HuOJd+prBdBt1wO0Clem096phh+0iv uK1pXyW0djTj9lnOzdFXFEPZNGE6FI2er82PHEO4awZTpunxOYAxXFKCbHBJzxOXH38a WOxZNc/Pr3bXeYYMC93JNaTnm7KgccySoTjy0g80QWTyrrYmGZGxmyQI6s74SY+yqdg4 euoqzYmoN0QzSM822fRom8I8Ms3AFAPmpeYigKKT8srATpLXAB1TpWep49QsHZsYLPer 7ghlvmywrOKP041uHOnIlLqepz8GnVvRQIwIimI2XggaazFGFyBXueYNLuquQzp5VsEb 7OqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SyZxv/EAQKEcZpJc5H6jMkdTT7uvFgE6kPACaSSxWvU=; fh=YhmxPC0NYagsxVMppzYMgO0XMWsRSWzMegLjmIklu8U=; b=cX/jCJDJ7HaJ+IdtIBUoJSa4OBPDsLwtjphm/KiI+6n5+xW3kSAwMDMVBzGUCPUmgO ngfhw0AvI24FNfFcYJSmf5EYKurm9bl5juNSMPaTPEITtGM2wgv52Ltu/ujfReSOpmS9 iH8WXhXWLyJEqSl3lVXijMTQlI+9RBOPtsYdRQO587UZjcooj9s94Qks1tve4IUVhX/I cb4TFrthzTCP2FlOKazCTT+eP4ov6/LsXBWxYR/RRndhCGLMBVw+fqVMy0tXzcw1y78j +GvuTY1xoQimLaDzryPDFcnQgt0mzivTua+0uL7YknlA8skb/vN8n7q8Z5XnA/G2HLHq z/hA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774385245; x=1774990045; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SyZxv/EAQKEcZpJc5H6jMkdTT7uvFgE6kPACaSSxWvU=; b=oLJchBJbZXklowtVvnYXjXnEK/9/62aANjBPooLVhiyW7CBsVu8qycQlopaebUzGaw KTV5FIGkSrWh4ppyCFSFsXLVPIBfRBWP9S2m+O7KV+AfYIdg6EU+5nhlS+Gngj/KgFDw 4DnHDpq4StHio+ELKDkXccHFZAuW/+3MWMvoEhFMUH4mMihLGJjqX3+aDAd/YLW7UKrN EXf8jFAwDOfmnIe2NWPXLixrvayGg171w39POY6yS/Y2AGZ9rMinEtM7ginUbZa+4fYf EgyRMNRbRZNW7+TQn2lmBz0vCcv83y1tno78ZV+4NNRHy/Ew8ScKrxWSr0ZGPPhvN4zb IjCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774385245; x=1774990045; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SyZxv/EAQKEcZpJc5H6jMkdTT7uvFgE6kPACaSSxWvU=; b=ialiOTyPxfmwT5oq4075yIfDTgwUgekq2OB1i1wU8iXbRjZhEXaS4n0Iyl8zXz9bIF iu4Yhk3N0Xyd/Fepj+Hlbf2Y8LE9FklLcarZVXgUwhyg97QEgEw32rwEteazbgWc/7lg kx8UQ/ZhkHuQ9a3JzjAkf1wgw1e3Cr04xD6m2b9mPlb3Q9rXMndIVtBCHyzYXUPNrnOE xzkpZBa4ffQGWnXi1mpZDuwPslNirMT+ebJP117DNBz7q2/8UwbsmN/XlE5WlXDYchv1 MdCkNP5fokE0F4fk1DnrnnmO4PwR0q7uWjv7WrtXpyPT2g35EQ+K4roWuPjdVfcy9nv4 vauQ== X-Gm-Message-State: AOJu0YzWJThj18adTPQW8EGEDRoV1vquyWS4gzmgf0ATB3B19FQqcNYX SdCkPlD/frtAnEooU+h622trbulgNScnd8fe5rSo/5/bE4rQOlZR2sw347/rqHNHrpOE/7pAa/T oWzDCbQbGrn4An3AcFxEZ+J8ZmQa/oMhSWw== X-Gm-Gg: ATEYQzyWc+gkBrq2fN3sX/mbSkF3AHGQaKHu4/+jc1HJx97LpTpvWQk37xPoD6Qhi2A KwQviL8cNWlQxqN87IuhWIt3oRpOvj+HrhpAnG93ZL4gNiBC3WoblGymo8IazeltRqxCdGS6oLZ SRg5DceumK0pLVw+KsPHWh3Jo3ah6ZMEaER/UzHQVPDGOAUPEnC02CiEniGng7cxD3tE2KmgPYj f63GDcr2k69rm50gamP7qgnmuJDZYUjbok9bhnCU8Oo+SazbxUmAUG4aRnCCq8v/mnZ1q4WLA8x jZCu9oZdhuQK4g4poaOIOcpGO6AK9e9VTlaSFPHp9XAk919Uww== X-Received: by 2002:a17:906:6a11:b0:b94:82e:55e7 with SMTP id a640c23a62f3a-b99c47c29b5mr48372466b.25.1774385244926; Tue, 24 Mar 2026 13:47:24 -0700 (PDT) MIME-Version: 1.0 References: <1136161.1769654478@sss.pgh.pa.us> <1299934.1773938807@sss.pgh.pa.us> In-Reply-To: From: Robert Haas Date: Tue, 24 Mar 2026 16:47:12 -0400 X-Gm-Features: AaiRm53V9RFM1EQamemnpzp6PGMx8fhqdDRTF-thENVeJT--SeY-kl8HBzIboEI Message-ID: Subject: Re: pg_plan_advice To: Tom Lane Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 19, 2026 at 4:38=E2=80=AFPM Robert Haas = wrote: > skink has a failure that looks like this: > > +WARNING: supplied plan advice was not enforced > +DETAIL: advice NESTED_LOOP_MEMOIZE(nt) feedback is "matched, failed" > > I think this is caused by a minor bug in the pgs_mask infrastructure. > get_memoize_path() exits quickly when outer_path->parent->rows < 2, on > the theory that the resulting path must lose on cost. But that > presumes that we could do a plain nested loop instead, i.e. that > PGS_NESTLOOP_PLAIN is set. And it might not be. Before the pgs_mask > stuff, that case couldn't happen: enable_nestloop=3Doff disabled all > nested loops, and enable_memoize=3Doff disabled only the memoized > version, but there wasn't any way to disable only the non-memoized > version (which, of course, was part of the point of the whole thing). > I think the fix is as attached. The new test in that version was exactly backwards. I have corrected that issue and committed this. --=20 Robert Haas EDB: http://www.enterprisedb.com