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.94.2) (envelope-from ) id 1ueJLP-007gmA-0e for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Jul 2025 20:12:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ueJLO-00CyLc-3p for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Jul 2025 20:12:10 +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.94.2) (envelope-from ) id 1ueJLN-00CyLT-QY for pgsql-hackers@lists.postgresql.org; Tue, 22 Jul 2025 20:12:10 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ueJLK-000Hki-1x for pgsql-hackers@postgresql.org; Tue, 22 Jul 2025 20:12:09 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-45629702e52so27306715e9.2 for ; Tue, 22 Jul 2025 13:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753215126; x=1753819926; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=MGKLYcYOZiFI01cuYBU0tKXK8BjMKhiMVJ1UynP97c4=; b=JcGhs8hx3mvGHlLqnWxzheE4RRGv0v4WxpAoIdM/S2GcBgtHEqq9xij2dZfyhCspxT aoPBsT1yA8a1okeR3ye6WYercVDmMUy4xtlZN4wd4UIBr5iZrs0M8bEKSj2gKZ18DjS/ uJJlz/vytb6VHJv0P+myDy9jJshr3UA/5If6ivOI0ApMQOJIxu+IjCcnc1kJH7CHbPZK A15wRv+WltuoECkDY+GXwXHEl/73X9qLOw+kUvXnYsrzBypq7103Owlsqx5cAkDkHoUi VLs2wWF8m99Kx3DZf6vhOI8Bp18mXNv/XWezZvKMzsnp2qRcOJ4p2x/MwUAGZN8zlS2S q2Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753215126; x=1753819926; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MGKLYcYOZiFI01cuYBU0tKXK8BjMKhiMVJ1UynP97c4=; b=MfBsqCozKfRpE+KcNxsoHarogLCklQqAG6SgZ8LZGVsIrmUJITozxU941jf3AD4iHD MmjTkkfIy7WVGiiZff0oUWj/fyQuxDpWQuBPwQfMN4iTOYLGwOn1OaOJhdGIpZ4+2S8b n/lyzUrY9yZbEx1hcftDklHyH93Hnu+vG2ngFr7kbx4D3wTwJgqoqyBUEn3VRV2wtsMV tkd/J8rqbSFOrsCGwcS4mBJz+MwZNw69PkWfXoYRK5oczIF//Yg9yvEa2lVk/id3fyfN JiOFsblmmxWNpUV+cNHxxlT6nSMXpmHXcDwzs1RMZQTrAWC2MvA92sP7cWbqDWk8ymbl 56uA== X-Forwarded-Encrypted: i=1; AJvYcCUPnAlVTfJrWv+OMKHtntBiG4tT4We6I8+lECuKXNY69/LW6DWYfWNjTgHQYAuRx+utBNsBPjyxvKlKgpzL@postgresql.org X-Gm-Message-State: AOJu0YxwzLlLeehhMb8zt4poU+hvoooyYozqmuXVTTySTbNFM18jI7E3 qQFqE/TySf6wAvaIQJlEXB/Px8+wgkQ4vA8jqJ3VLjWXJu4jOvp7iw0Z X-Gm-Gg: ASbGncsM4zGtThE4kpwK0Ri2p8iadxo+SGavncnpsV2j1+aPovatvDrRhTTdb6mHLK4 az+Q3X6TRM0DjQ3oijHoeVsvgMMslJspqKFL9T6US2+txeGmAfF6cg6yX9hKH0dI+Z0ij0bH8UD /lBR1s5RtyTyrxORNhsEU+NUVpiH9/cbpHIlnI8ujdSugPhVBjcovxwL6WJQz1u0Q4ILkzx5ydC vOMtyLUBdZ6ii0Drk/Xrv1+7aUAGPTTJrKlE6/dOoN+rvJ1wisKs1AVRnZ7vR4xGAarvQALGeri SfNpDk2W36Gs3Yv2GN9lIcC4tXihm++3y0RQzECwRwr/mWg/rVM/k5TOJIkARYjRhwelkl1MQ4w UgqtolCiXV8N0h4GWWEGNp8FiUZ5h+xmi1i2xzCzamVjEhJCc91uPrcKi X-Google-Smtp-Source: AGHT+IGd7eCaHCMVffWrn18g3mH3ndQqnG3hDLhVjxpUg1MC5/6Yq+XZdKd7tSvo8EHBGgUQaJjeKg== X-Received: by 2002:a05:600c:529a:b0:456:26ad:46d2 with SMTP id 5b1f17b1804b1-45868c75dfamr1369215e9.6.1753215125877; Tue, 22 Jul 2025 13:12:05 -0700 (PDT) Received: from [192.168.0.89] (84.123.234.224.dyn.user.ono.com. [84.123.234.224]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-458691b2adesm341155e9.32.2025.07.22.13.12.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Jul 2025 13:12:05 -0700 (PDT) Message-ID: <09a82e0c-8c37-4366-9807-6553fa83a3b0@gmail.com> Date: Tue, 22 Jul 2025 22:12:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: track generic and custom plans in pg_stat_statements To: Sami Imseih Cc: Michael Paquier , Greg Sabino Mullane , pgsql-hackers , Nikolay Samokhvalov , Ilia Evdokimov References: <5f775987-8a93-452d-bb3f-a1de53836406@gmail.com> <56d31e81-79d8-40bd-b957-0d6dc7c46589@gmail.com> <2f2bde53-972d-402c-9da3-c5467cca00bf@gmail.com> <064b9efd-92c9-4670-95f4-d911d4c7ddeb@gmail.com> Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/22/25 19:13, Sami Imseih wrote: >> It may be more efficient to set the is_generic_plan option at the top >> plan node (PlannedStmt) and reference it wherever necessary. To identify >> a cached plan, we may consider pushing the CachedPlan/CachedPlanSource >> pointer down throughout pg_plan_query and maintaining a reference to the >> plan (or simply setting a boolean flag) at the same location — inside >> the PlannedStmt. > > We will need a field to store an enum. let's call it CachedPlanType > with the types of cached plan. We need to be able to differentiate > when cached plans are not used, so a simple boolean is not > sufficient. Sure. But I modestly hope you would add a CachedPlanSource pointer solely to the PlannedStmt and restructure it a little as we discussed above. And no new structures are needed. Am I wrong? -- regards, Andrei Lepikhov