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 1vTRRN-001l8X-1w for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Dec 2025 21:09:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vTRRM-000yLY-1l for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Dec 2025 21:09:41 +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 1vTRRM-000yLQ-0h for pgsql-hackers@lists.postgresql.org; Wed, 10 Dec 2025 21:09:41 +0000 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vTRRK-0002fh-1t for pgsql-hackers@lists.postgresql.org; Wed, 10 Dec 2025 21:09:40 +0000 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-7c7533dbd87so254291a34.2 for ; Wed, 10 Dec 2025 13:09:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765400977; x=1766005777; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3MjdYh4gvMsmpgClGsrpTIcZ+ceE9hgtEgwDBQ9aXHE=; b=GcfjxdybOz/5sUvBfvzO39toi1ug6BS6bYvOS79qCMOPMy4OJRvpFU6MBPQQw+/YJP qgC+0H8ZEH1gDv40oROfhO53m7h/Mht3dkSRHmzuTmYuUWHbB8QxYjTeNtkJxyc9GgS4 AMjqcF+mZeRcFPLxdPfpS5YndhwuIcTrpyT82Pk/5s8OUGUGWtn3mEEmoa8z3L6QlOn1 4jVtERmywkXc8HXGh4lJYooyhQCDit4SVdn0ipWuKSVNjcSj0Fhbjkj/Nj+4yGtAAcLZ qvX9s+vof/PyfRA+EZDUfKVMo8gSj2KmAVBt0oGZIhJ7K/Vx/yZ6Otd6MBCXr8Kt97XA Xr1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765400977; x=1766005777; h=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=3MjdYh4gvMsmpgClGsrpTIcZ+ceE9hgtEgwDBQ9aXHE=; b=FgFI2V9E5G3McfBLYZdaMey2H5GzJ+LtNWLBpruRaOWuBpVr/uasrnWfXcredD4O5v YEUC+1VbzzCf1QaHV0VHSQG3GlsL3lGgD5pWbm9v9/zyQl3KjMZW/V/+OzjehHMQTKTK C2yahaq3sp2NtQjZVuR0FqSXYRDNnGe9/X7U98EJXrdWZszNU8MZydCXy8VC0XGMAgbN 1shleZNVPsSdzLFcj53Cf7CBK8rOINsOvARjsQLe3zuhfRNiz8XPtet5iUvYmCp9MDVv ge+RYd41p3czxO0PT3ETvhcsHxd8umekhRf8TV62T4Ltyx2+5sJVET9sHl2JsjUoJ3FJ JjaA== X-Forwarded-Encrypted: i=1; AJvYcCWIFs7QS+nc41BJB6AySiuTI2QaNN20oswbzo2P66jRs7sgXdGCXiZFjPrmiVwus5mYDTEAyEx+LRBjf/Pb@lists.postgresql.org X-Gm-Message-State: AOJu0YzSKtQqlVPz+5IJE+3r7RBgMW2W018Ny6mar6t+lQvt+rXytVqy vLm5pAw1PFq5x2eR8K0RPbxchXInOT6Dewwq962/aJ2CvNQH+QOzi3hhrqTUR5EV0FzlcqYJiu8 3z896DDZ7tBsikYLxUI5EMFI2gtLpdFA= X-Gm-Gg: ASbGnct6d3JsTRiTTcnF7xYTQSRZnWiOprdclTn78USuW25serBJoxJGSg6oG7ZZFAU 5xqNXM8sajmBfVAbZ/+/2Dc43scTCrFdxUTqj6R3Ynn8reYUvPWzZfK1e/11EKRVl3ckPrZgOhX EL+QIp1+UY+b8F26rCMd3nFw6iM+qXO9tNLCpxT7Wrv8AHsAYaprF7NASAj2tV/vL5eKeJctTEN IKPi/vRxqVbZSsDC7tRzB5T6An60KJNTzq1b1GdewRq2DkJG+/UtZMtiNvS/G7YxCCiuOGlE029 hYWCE2DnXIVUGJHrU9DxxHLbcaVbAs6V61Tklg== X-Google-Smtp-Source: AGHT+IECKFvoxv8NSBdgoW+qu1riZ/+rLOUEZtb3QQd6SnYoTjwnYlWtS+q0x1OJl6e6BXaSdsxrSrkJIyz6d/2fFkc= X-Received: by 2002:a05:6820:221c:b0:659:9a49:8e92 with SMTP id 006d021491bc7-65b2acaf82dmr2415473eaf.22.1765400976807; Wed, 10 Dec 2025 13:09:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Corey Huinker Date: Wed, 10 Dec 2025 16:09:24 -0500 X-Gm-Features: AQt7F2qKbeOSOCz_LWTAi-1WVyUhVUFPwrH524DMDDwXi4YTb08pbuHvIU3NkHs Message-ID: Subject: Re: pg_plan_advice To: Robert Haas Cc: Amit Langote , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000001bdca106459f72b3" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001bdca106459f72b3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 10, 2025 at 9:54=E2=80=AFAM Robert Haas = wrote: > On Wed, Dec 10, 2025 at 6:20=E2=80=AFAM Amit Langote > wrote: > > These are just high-level comments after browsing the patches and > > reading some bits like pgpa_identifier to get myself familiarized with > > the project. I like that the key concept here is plan stability > > rather than plan control, because that framing makes it easier to > > treat this as infrastructure instead of policy. > > Thanks, I agree. I'm sure people will use this for plan control, but > if you start with that, then it's really unclear what things you > should allow to be controlled and what things not. Defining the focus > as plan stability makes round-trip safety a priority and the scope of > what you can request is what the planner could have generated had the > costing come out just so. There's still some definitional questions at > the margin, but IMHO it's much less fuzzy. > I couldn't have said this any better than Amit did. In my experience, lack of a plan stability feature is far and away the most cited reason for not porting to PostgreSQL. They want query plan stability first and foremost. The amount of plan tweaking they do is actually pretty minimal, once they get good-enough performance during user acceptance they want to encase those query plans in amber because that's what the customer signed-off on. After that, they're happy to scan the performance trendlines, and only make tweaks when it's worth a change request. But that's not to say I disagree with you categorically. Suppose we > decided (and I'm not saying we should) to start showing relation > identifiers in EXPLAIN output instead of identifying things in EXPLAIN > output as we do today. Maybe we even decide to show elided subqueries > and similar as first-class parts of the EXPLAIN output, also using > relation identifier syntax. That would be a pretty significant change, > and would destabilize a WHOLE LOT of regression test outputs, but then > relation identifiers become a first-class PostgreSQL concept that > everyone who looks at EXPLAIN output will encounter and, probably, > come to understand. I think the change would be worth the destabilization, because it makes it so much easier to talk about complex query plans. Additionally, it would make it reasonable to programmatically extract portions of a plan, allowing for much more fine-grained regression tests regarding plans. Showing the elided subqueries would be a huge benefit, outlining the benefits that the planner is giving you "for free". > > On the infrastructure patches (0001-0005): these look sensible. The > > range table flattening info, elided node tracking, and append node > One thing I am curious about is that by tracking the elided nodes, would it make more sense in the long run to have the initial post-naming plan tree be immutable, and generate a separate copy minus the elided parts? --0000000000001bdca106459f72b3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Dec 10, 2025 at 9:54=E2=80=AFAM Rober= t Haas <robertmhaas@gmail.com> wrote:
On= Wed, Dec 10, 2025 at 6:20=E2=80=AFAM Amit Langote <amitlangote09@gmail.com> wr= ote:
> These are just high-level comments after browsing the patches and
> reading some bits like pgpa_identifier to get myself familiarized with=
> the project.=C2=A0 I like that the key concept here is plan stability<= br> > rather than plan control, because that framing makes it easier to
> treat this as infrastructure instead of policy.

Thanks, I agree. I'm sure people will use this for plan control, but if you start with that, then it's really unclear what things you
should allow to be controlled and what things not. Defining the focus
as plan stability makes round-trip safety a priority and the scope of
what you can request is what the planner could have generated had the
costing come out just so. There's still some definitional questions at<= br> the margin, but IMHO it's much less fuzzy.

I couldn't have said this any better than Amit did.=C2=A0In my = experience, lack of a plan stability feature is far and away the most cited= reason for not porting to PostgreSQL. They=C2=A0want query plan stability = first and foremost. The amount of plan tweaking they do is actually pretty = minimal, once they get good-enough performance during user acceptance they = want to encase those query plans in amber because that's what the custo= mer signed-off on. After that, they're happy to scan the performance tr= endlines, and only make tweaks when it's worth a change request.
<= div>

But that's not to say I disagree with you categorically. Sup= pose we
decided (and I'm not saying we should) to start showing relation
identifiers in EXPLAIN output instead of identifying things in EXPLAIN
output as we do today. Maybe we even decide to show elided subqueries
and similar as first-class parts of the EXPLAIN output, also using
relation identifier syntax. That would be a pretty significant change,
and would destabilize a WHOLE LOT of regression test outputs, but then
relation identifiers become a first-class PostgreSQL concept that
everyone who looks at EXPLAIN output will encounter and, probably,
come to understand.

I think the change woul= d be worth the destabilization, because it makes it so much easier to talk = about complex query plans. Additionally, it would make it reasonable to pro= grammatically extract portions of a plan, allowing for much more fine-grain= ed regression tests regarding plans.

Sh= owing the elided subqueries would be a huge benefit, outlining the benefits= that the planner is giving you "for free".
=C2=A0
> On the infrastructure patches (0001-0005): these look sensible. The > range table flattening info, elided node tracking, and append node
=

One thing I am curious about is that = by tracking the elided nodes,=20 would it make more sense in the long run to have the=C2=A0initial post-nami= ng plan tree be immutable, and generate a separate copy minus the elided=20 parts?
--0000000000001bdca106459f72b3--