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 1vYuLR-00H1yV-22 for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Dec 2025 23:02:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vYuLQ-008BYb-0U for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Dec 2025 23:02:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vYuLP-008BYT-2j for pgsql-hackers@lists.postgresql.org; Thu, 25 Dec 2025 23:02:08 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vYuLO-002ceC-2U for pgsql-hackers@lists.postgresql.org; Thu, 25 Dec 2025 23:02:07 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id C07C4140003D; Thu, 25 Dec 2025 18:02:05 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Thu, 25 Dec 2025 18:02:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1766703725; x=1766790125; bh=ehu04c8cb+ eaAQqaHdw2/9125Jj4D1hXZkDLVal1hd4=; b=d7g8/smCBCJtQB1wdFmS4maAWz oUMg2/Y6lL8bh9mdhqE7+WZeV24sXK3wqVPgq/BkH1YEXEcA+gdZDu+5O6vhLAX8 9YkaCgJTzKCJCk2stt9v/+SequNVoMSg2VdibXFGmJghsVQdG6AaIU4+atE0tfb8 t44HXelOKL8KPUzJoDfGV4vtQ4ZzmBr+1A7n7US25V5lqwD8o27i+rVhmtEVZDhY uPxmwRoHA4GvbQn83ILuFtdjU5H+tDX5LL5y4i98YdOfHzdZZzSgKg1GVEcStbb7 lgAZt6oKre0Wah9c7nmUNCDNlGTR+yiB6W/oAbJHatOcdo0XATANjAJ018kA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1766703725; x=1766790125; bh=ehu04c8cb+eaAQqaHdw2/9125Jj4D1hXZkD LVal1hd4=; b=C6lXgfStSfaxqDarw8rQxH5PkMtS3eAPrxmzxwVWIe0wpAZwYfO d4tEtTbAqIX6gV3NUK/HuouVK+HVssNa5VCsoGWn8gy0cJCTeVY7CKl85hi58a0l MxE2JYtJcUkEvUPfq0zhomWY09sAIYYnZzKFID8A9tP9ZC1RE40zpeWg9SeyxijV nMy/wv4pUer0JbFNWxCUi4IdAlRaecvOFIlveZyLyHsx6kMZoopjZMBeJHuZXe1g dpjKWQ/Dbm7PCyeOXBFjMKNC5rAcUmsqIqsgbn1SEd6zYOKBxZRqaoMnJanpTYb6 eyZWE9yHhih9vpPrsL0xxCrINs+imMEAv9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeiieekhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtjeen ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeevteejgfejveegudekheeiueeiueei veeuiedugeehveeugffgudeuleegleeiteenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhn sggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrnhgurh gvhidrkhgriigrtghhkhhovhesthgrnhhtohhrlhgrsghsrdhruhdprhgtphhtthhopehs rghmihhmshgvihhhsehgmhgrihhlrdgtohhmpdhrtghpthhtoheplhhukhgrshesfhhith htlhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhp ohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehmrghrkhhosehpghgrnhgrlhihii gvrdgtohhm X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Dec 2025 18:02:03 -0500 (EST) Date: Fri, 26 Dec 2025 08:01:41 +0900 From: Michael Paquier To: =?utf-8?B?0JDQvdC00YDQtdC5INCa0LDQt9Cw0YfQutC+0LI=?= Cc: Sami Imseih , Lukas Fittl , PostgreSQL Hackers , Marko M Subject: Re: [PATCH] Optionally record Plan IDs to track plan changes for a query Message-ID: References: <404111766672953@mail.360.yandex.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/pJM2jmFRRbkZiQc" Content-Disposition: inline In-Reply-To: <404111766672953@mail.360.yandex.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --/pJM2jmFRRbkZiQc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 25, 2025 at 05:33:11PM +0300, =D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0= =B9 =D0=9A=D0=B0=D0=B7=D0=B0=D1=87=D0=BA=D0=BE=D0=B2 wrote: > I=E2=80=99ve been testing the proposed v5 plan id work and found out inst= ability of > computing the plan identifier after feeding different query texts that > produces the same physical plan trees but with different plan ids. The ma= in > pattern regards with fields of Plan node structures that depend on positi= ons of > RTEs in a RTE list. FWIW, I don't think that we have a clear agreement about what would be a good enough ID for plan trees, as it may be also a per-vendor computation that fills specific user requirements. + /* + * COMPUTE_PLAN_ID_REGRESS means COMPUTE_PLAN_ID_YES, but we don't show + * the queryid in any of the EXPLAIN plans to keep stable the results + * generated by regression test suites. + */ + if (es->verbose && queryDesc->plannedstmt->planId !=3D UINT64CONST(0) = && + compute_plan_id !=3D COMPUTE_PLAN_ID_REGRESS) + { + /* + * Output the queryid as an int64 rather than a uint64 so we match + * what would be seen in the BIGINT pg_stat_activity.plan_id colum= n. + */ + ExplainPropertyInteger("Plan Identifier", NULL, + queryDesc->plannedstmt->planId, es); + } Now, looking at this block of code, I am wondering if you don't have a point here even without compute_plan_id.. Could there be merit in showing this information for an EXPLAIN if this field is not zero? With EXPLAIN being pluggable in a hook, I doubt that it matters much, but I am wondering if providing this information could make the work of some extensions easier. -- Michael --/pJM2jmFRRbkZiQc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmlNwlUACgkQnvQgOdby QH1PAw//eBLZL0MxVfNsBjQwdFARdZhsVuQ/fONE52Pg4jORPYf5tmxnzbvdbqlR O54BAEqity8+xkoeqa5uo5aYsR/z2sf/ubURmRwW1YcBYym0sDuQAzlphftXA6oi 6bLRGIPQkw38YFTOwOrIMgLe4Uf0UydQfW8DC2gdsuddUXJj/NOP5/ikG9jiAOHx J0YLK6lL8slCnv18LbPS6E3/1eR3WE8sUiyuAph937PBUCcIXL/HLRoSwMA17bEw 3Kz9maZ/TEfGap1P8XvUrR4mEVeGJ3UrNe3XyegjyNKSEP/GOvusTNqIX6Kh9x7v wZalUcFHg3i9H520dY2zvDeVApGusi5WU9q+Whu6TIoE52GbqL3BhGhCOLBZHXUP GFG/+9VdNlJSXg89xf6eaXxFwXkmJFzxNaLQvM4sw9iR1axawSFdvW4DNF8GfQJs YJ1YqalqJHf9DI8SyJF+VucO9UtqetSSTcfkZWMrTWtKfq8zzS6gg1kgo2DWaXCn U3BR7YJKx4k+WVCPfyiuVjWIXSX+k8t+lk4cLDpYjLWuZILthGs7i29PXvytRSzO ANjmCfjzG5mYyD844wN9iPJq6kOwLRkUBrbtpXDYdOBIMfiYp+afGzeLL/iCMfJB cw7A9eW6IxYzE9Qv8lJio3h1VVKH7oAiRlWiH4O5pp+yYQUT6YU= =8KbN -----END PGP SIGNATURE----- --/pJM2jmFRRbkZiQc--