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 1w37bh-000v84-0R for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 07:15:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w37bf-00GzHq-2m for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 07:15:47 +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 1w37bf-00GzHh-1h for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 07:15:47 +0000 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w37bc-00000000UmH-011P for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 07:15:46 +0000 Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-8cd8347d9fdso98507185a.1 for ; Thu, 19 Mar 2026 00:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773904545; cv=none; d=google.com; s=arc-20240605; b=AKowNidgTz2VyX9SD5RD4ME3QhVOejgffNu2QA3kk5fg9jEjF3rfjNJ9VxSm8YyFcc uh5UVP/AFDA3OvM9VNlcEHE9/qowwPESxy0Asphw7wu7Hz32ypXL4GEayVHxVpeKrM6d Xio6Iv4BMaBdT99OTyToqoMfnLf27mJPjsJWbSUkeoolgJgzG8UiXKzV7qdsz4peMs9I zIDNzlV9KasKtFaMq7zeEud0COVhYR6z3i3VNMJnjUeekJWoUx9kBCqb3khACDesawRN iOcbYRltXtn1Fr0e8PbnYj2IgI4aMnUOY3sYdlmFE1Gm29r+o573ORaI9EjikvE3L0YF bl+Q== 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=yXVqux8l4v8OaVxEECvT3OexjeWdiEz42Mf0q9aQoBQ=; fh=pcWK4vtV6m1q91NDqwgtKuPhlg49rYv+hme/Bo8NdyM=; b=X85p54GjFQnSVE3SkNbfuf1x37gUoVJGkHSqZGit+8Ckg9tg9p2qhgc56/qh0uKTur hj8tAM/aX3sAIgZKnqQw2+pOJ6RZd3T7YsmwI6WtK7PjksIXXtKsLpcyChuoPmU+BfAB m30kyB3kWconunJFyPYH5e/fC7D/lWQMJgcJ5rBAgBa8c8uFS3U3YA0kFlkA/b/CrrHF Kxwk0m7HkF0wRJ0OvM9kusp7BdFM9ov19CY74I+u7vI0C2TY+YiB5wsa1AdTc2so2tSO qVcbZEKG+22RpCJHTLDwZSv89YzZG59R29HZ3n3IxLxX2m6fOSn564rtUepmwzZBzp46 U0yw==; 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=fittl.com; s=google; t=1773904545; x=1774509345; 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=yXVqux8l4v8OaVxEECvT3OexjeWdiEz42Mf0q9aQoBQ=; b=H4II7siWNMtrXYTLaADh0FBCIIom2UM9urg3qLr4OcO3MXFlq/J3s8oyrNoyUBtK3R SrTlxiSaCs6Vcnrfd31DloJcu6juqpErGFGS39NeaQxO3bb+mOlsevdSApzY6x21r7qm TZR2u6WSowQEi3gJ9FLPUMXm19k0Y6DyLVjsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773904545; x=1774509345; 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=yXVqux8l4v8OaVxEECvT3OexjeWdiEz42Mf0q9aQoBQ=; b=J0BclI31i1f0zZX6vJgw05NIYvgJN6imLR5bdWaQzGeHIGsqFDlDzltrVrHhdjbGZ4 NliqgdqemK1uTEsEqclV4mrnvy8ymtikz1Fiu2rMl3IIHRkhyq8f8jwAC+uOBztU4kN4 BqifYy7SdG9YDmL5mjbqRHBAMBtF2GZGagN2NtoCheZueHU8mFEjPQ+CCqGtXVlbOEFm HAqLfkoUwYryIakvaxhSKck4WiVjDoE+J/jHgTQqYWC6SCwodvhpBoGlRH76ZmkLjp7m 0WR0jIIM1PJ0/SXp+U9bJcZbv6rZ61H63OPoEEDHMjD7XtcdszP/Pvfx3d27DXGu6pef Oh2A== X-Forwarded-Encrypted: i=1; AJvYcCVnHjKmXybkAwSKO3s16QnBbABHVzSbWM+1eXJtF2Nl7APMKU881R34rCM2Wgfvg1qNX8+BSMMrRNsNO6GS@lists.postgresql.org X-Gm-Message-State: AOJu0YzCCAnj01reBp+PmGRga0TD28wPit87CDjn7PHUqLyOoCffKv9J adT7yUV2x8T/CRAshFGwifBTaLI89hdPIGxjgISllgXvPzQCjjbl3XammDDFdP6DlBiGNpApq3q 4EmSn4+YcsbLb+9kLLYgElG6g/4nR7Ff1n+ohWjfd X-Gm-Gg: ATEYQzzvJgqG05/MbL7mg4bpCY+PxUdg09QYsUWCEtn7eCJXNNxO/hD6JnLuURstHzq qsoYEUXHYrbhXllmHrg+PabMdUqAkrA7Sz7leJfacEK6zWiv4Wc2oGFHWZmT4cfoc4mhAtMt0wb xNf7oiNn/MCT6XpCbGc/HuIyJ4K6lX4rZwi82gOsUM3c5CNJy02Lj25635ifwtCU34jaIx2Hfix +wGzD76Ubj33+m9wS0li4vNZ3C/zExL/WITnP3SRLpWkLi4wI/57RZHT/FK/qcLS+zDaGCItX7C YSEgvakiHUceSMm+8sxe8FAQLLEZUnc2JZ/dc+dg X-Received: by 2002:a05:620a:44c2:b0:8cd:b33a:a4da with SMTP id af79cd13be357-8cfad37f90bmr792453385a.55.1773904544684; Thu, 19 Mar 2026 00:15:44 -0700 (PDT) MIME-Version: 1.0 References: <404111766672953@mail.360.yandex.ru> In-Reply-To: From: Lukas Fittl Date: Thu, 19 Mar 2026 00:15:07 -0700 X-Gm-Features: AaiRm50n_7q7eT1sso2mE1-J33rFUCHZyps0Ucn5GX7W4tjZecbSIgMBbARAGJM Message-ID: Subject: Re: [PATCH] Optionally record Plan IDs to track plan changes for a query To: Michael Paquier Cc: =?UTF-8?B?0JDQvdC00YDQtdC5INCa0LDQt9Cw0YfQutC+0LI=?= , Sami Imseih , PostgreSQL Hackers , Marko M 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, Dec 25, 2025 at 3:02=E2=80=AFPM Michael Paquier wrote: > + /* > + * COMPUTE_PLAN_ID_REGRESS means COMPUTE_PLAN_ID_YES, but we don't s= how > + * the queryid in any of the EXPLAIN plans to keep stable the result= s > + * 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 mat= ch > + * what would be seen in the BIGINT pg_stat_activity.plan_id col= umn. > + */ > + 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. I missed this at the time, but happened to run across this by coincidence. Consider this a late +1 on the idea, i.e. I do think that emitting the plan ID as "plan identifier" in EXPLAIN seems reasonable when a plugin sets it - the cost is negligible, and it'd make it easier to work with extensions like pg_stat_plans. Thanks, Lukas -- Lukas Fittl