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 1vxdaL-00Gzig-20 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 04:11:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vxdaK-00A5Az-0D for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 04:11:44 +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 1vxdaJ-00A5Aq-2P for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2026 04:11:44 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vxdaH-00000000OAY-3sBI for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2026 04:11:43 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-7d18c654458so3144991a34.3 for ; Tue, 03 Mar 2026 20:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772597499; cv=none; d=google.com; s=arc-20240605; b=HvvplNu2NaUpPZ4mYGsi9lZ/u1I/zU5sXDXw3PfyHm4deBeV5Y+U7TWQyoQBMncZY3 RPgoK56+j9QMIFH2+PhXso2ETg+l+JG7LWjWAWraFKkKHUMxg+0NIpDZuIkSY2x2LX7s 7PfBZ9WnmY+fYZD3rCRlNNC4WMnp5Vi35VzcDcPLJH4PON/YnpopIrP3Pmthy4hzFfE+ gmb41filRuzAXjnqZGJdke2AGUc0AVMZiEhUg9DYrpnZRdnQQAXo20er25ooPf1thZF3 /H2ZmEOyKkfHBXZGXnRtWJ95mtF4crgLNK0i9JXeZxgbgfvtLV3R/IBROBHfTYZbr0/e iSIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dkim-signature; bh=8dCf3nQz49/S5b00GcJpv70bd1pFILaK2MgoLl2Mv6g=; fh=cqbWhBZKd7QbGLcJKiEe1vfifja3Mx8Jk/oiOsp7fUc=; b=lRJSX7U8oFoyCOxkNPWJsowzNdkwCGT0sVBakGHCOATqHzZnBIZRvUq/aHr8TohI8S AImRgWJ3P1wHD5H2CtGCPIZ9KR9CJ49HXGXk86Lr7veW6H9tWuKsRazfmFOEV3KhVW1b DgG+4VQJRQtZc8n+TakbmMr2cfoyDgus/PAH082cxF9D1PfC+aS49yxv0cuDpy9TzIEH 6DTsrmcH+ODzJz7ijgyzVhEAw14YzJX+LglNJ55edmMfT88K38AMJooChJAyFWX0CLSj 2cukTKX3pmLC0hXjCfrxLXo/zElvmM+elghm2fROl8/TqDnTwY4pi8IH/7yZqjf1yPhE +eZA==; 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=20230601; t=1772597499; x=1773202299; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8dCf3nQz49/S5b00GcJpv70bd1pFILaK2MgoLl2Mv6g=; b=TwEniHnwAq+qWdg3byXtN/+i8wgzCJgrhbwwt9xK1L6/lVc9t55YUt/cNmx20t5qaq +pW9ZHUP9BlWgShKCGVM5DvPOUQaYys8Gyf8tIyZ639QqopJPoFmLylbCzYA+Ww1Zr4r Nw7yUdbikXkdar1XLZRqPmLX0Qed53W5pj3ljZvHURPW7ip2JEL7wGMcxJ4uJjtKQtD+ 8nsgD63O6oz9kmPljKh/5MbZtIlbqd8SMb3D1ckND6xZW16vP5GxK/eNQBZ+vwbAME/G /Vd3Gdf/QSpHb7Hx3mpLb1+IEgdDkOTVlNt01h1j6hNJioflhEJ9kASe0tKMGRWFDxzn L4hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772597499; x=1773202299; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8dCf3nQz49/S5b00GcJpv70bd1pFILaK2MgoLl2Mv6g=; b=ks82/545buz59p93YYmFDV9OpeHvc4rC1xKWSmU6ydUrVX91SgdryfXPBji1LjW+g7 fMgjlyh9Sp/WP8HozdTEN+2rKkj0yI88kDh5mq6qpEta9f9002YdRcwund6TlQkg8Cgh tZg07HO2qSTqfn/7KX74kZlo2fVmZnrR0UUixzIg4DrtSzC6LDQFVJcmNZA4Yaecd+Zb DXDnmtIePO7BiPYLh8DOjcAa2yw688DLNousqzmBRfFeqzGjOFBnbYvAwU2UYigCHJok G/We2u9j+ah9xDVCb2vXEG5kOPp/IJRX2KR9z7AV7TGdctnwpBMZKtV0inDQ/MX/b7/S 0z2A== X-Forwarded-Encrypted: i=1; AJvYcCUjiigfao0jhUp4UA7n4H6CeaXy1UGOsFOLdzwegbH4Tv6eRnAochYz1rIYavpdbNzxceXpNHzmXOJiiZyo@lists.postgresql.org X-Gm-Message-State: AOJu0YyfcQ6pHwfwmiwNrq3nPFD5tTuf41uPTdjmWm42vV/R1BHk89Yg Wz0lMtWHw5/OSYP7ME6qQDA3rsU2p0vJDvo0kncNvaxRJZG+BbCN0VKkrMefMBJr580bYH7XlFn lWYQdH80caJLK4sdflbKW9hxejbOFomE= X-Gm-Gg: ATEYQzzhEuXddJ7JBdcvOcrZJtBRbWyIIMsKqVrs35LC7jDyz+sTBw4L/DAGilnD5nq JbdWcI0ii6UksXeoEuex9xP0HP6pOhjo2dmOCxyStONeEJog7STcwjWuhwBmIjYeuTgA5eiQ+kx /SshOVGKnzbakxRmzJASnv1NprwKr2UIssSnkKDboVb+NR7W6PKseExDR8vxH+puEyAPj6YxTnY tQXMwa1zDExTYMLOyp1KyEHtk+hF+ZBBhTvarv8pRpGLv+mJPi2zBoSFlx/RqleC/zGPliycRyh t0lUzuc= X-Received: by 2002:a05:6830:388c:b0:7d1:90d6:1f5c with SMTP id 46e09a7af769-7d6c7f4bc25mr398613a34.4.1772597499028; Tue, 03 Mar 2026 20:11:39 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a8a:1051:0:b0:61e:b2a9:6fbb with HTTP; Tue, 3 Mar 2026 20:11:38 -0800 (PST) In-Reply-To: References: <1136161.1769654478@sss.pgh.pa.us> From: "David G. Johnston" Date: Tue, 3 Mar 2026 21:11:38 -0700 X-Gm-Features: AaiRm53r8Vm2ZRLveqxt45e4pdpTgv4UvsAfTxvOolTlX0XnIZvVEHjX60wuSUg Message-ID: Subject: Re: pg_plan_advice (now with transparent SQL plan performance overrides - pg_stash_advice) To: Robert Haas Cc: Jakub Wartak , Alexandra Wang , Richard Guo , Lukas Fittl , Tom Lane , Jacob Champion , Dian Fay , Matheus Alcantara , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000004267a5064c2b04f0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004267a5064c2b04f0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, March 3, 2026, Robert Haas wrote: > > > > > SEQ_SCAN(t1@minmax_1) /* matched, failed */ > > Because there's not a way to control aggregation behavior at present, > you can't directly conrol whether t1 or t1@minmax_1 appears in the > winning plan. Ok, that=E2=80=99s what I was missing here, it saw the subplan in its optio= ns but the winning plan didn=E2=80=99t include it. So =E2=80=9Cmatched/failed=E2= =80=9D may produce a plan where the target having been matched isn=E2=80=99t actually visible to the = user. Maybe add a note like this to pg_plan_advice: Generated advice is produced to a high level of specificity without knowing what limitations the advice interpreter has in applying that advice. Therefore, generated advice targets may later fail for no other reason than cost-based decisions resulted in the originally chosen plan to no longer be chosen. The planner will still likely see the original target on a now losing plan and thus the advice feedback will report matched even when the winning plan does not include the specific target. David J. --0000000000004267a5064c2b04f0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, March 3, 2026, Robert Haas <robertmhaas@gmail.com> wrote:

>
> SEQ_SCAN(t1@minmax_1) /* matched, failed */

Because there's not a way to control aggregation behavior at present, you can't directly conrol whether t1 or t1@minmax_1 appears in the
winning plan.

Ok, that=E2=80=99s what I was= missing here, it saw the subplan in its options but the winning plan didn= =E2=80=99t include it.=C2=A0 So =E2=80=9Cmatched/failed=E2=80=9D may produc= e a plan where the target having been matched isn=E2=80=99t actually visibl= e to the user.

Maybe add a note like this to pg_pl= an_advice:

Generated advice is produced to a high = level of specificity without knowing what limitations the advice interprete= r has in applying that advice.=C2=A0 Therefore, generated advice targets ma= y later fail for no other reason than cost-based decisions resulted in the = originally chosen plan to no longer be chosen.=C2=A0 The planner will still= likely see the original target on a now losing plan and thus the advice fe= edback will report matched even when the winning plan does not include the = specific target.

David J.

--0000000000004267a5064c2b04f0--