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 1tuVeD-009LC4-EY for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Mar 2025 12:02:17 +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 1tuVeA-00DAEj-GJ for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Mar 2025 12:02:14 +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 1tuVeA-00DAEb-6e for pgsql-hackers@lists.postgresql.org; Tue, 18 Mar 2025 12:02:14 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tuVe6-003YQK-28 for pgsql-hackers@lists.postgresql.org; Tue, 18 Mar 2025 12:02:13 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4393dc02b78so20672875e9.3 for ; Tue, 18 Mar 2025 05:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742299331; x=1742904131; darn=lists.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=dJVs3PXmLsfro7+kzWATsRlohDGe1BdeuGbXBNI2QFs=; b=ZZzeSUUeHv5HIkxUWpw+S/HrRG3Bg8coSxYlB6e7gSfZZSaSV11kYcIZhPonsNY+WH s6T2WZLsJEIPDbsyXrtYCoGGA35MtZnlxJuF7zWAXaGzt1e6r1EJq0Krsxqzyf05bDLO EN9zZUwhJeDTlw8tx8mmAaPAoFYoD1y0ZzbuoeLeaiqnmoIaFdL8CFcWW6SKzBcOXKqt M3StK0VVcmA/F86XVkDY0eRmiJ1XxP/dfoTtLUSpQUgBSClbPRhd/S5+2no9rAP9wuZk AiSRqNoRHZptGskSc+Th4WMookwUGo4Y534VMp0uGDo0wYCTM+0339KLsR4bFeo8Z/kc 9xTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742299331; x=1742904131; 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=dJVs3PXmLsfro7+kzWATsRlohDGe1BdeuGbXBNI2QFs=; b=UxvyLquGFwrSCN9OuHxtPkdaiotr7IGRozkw3P4ph/5GamOEOFmdhKKXIwN8MFYIrz S3ksJ8+CaEREKKt0inBLVtyi7VHFDpl8Yn68WkbJhB9ESrperl+1MZF/OzvvUWlhFOxw hLYysrd7NXdhdJ9G9E1hxMCL/tTt0Fc+MfAhxLFCBh6TClh1qSGBKP8o+Hj7/mpM5r5R Q2h14r/To1nr7kHpsBKOODWJ797j0KgjszfJHfknETkZm2U4rROaDlK9C8lZjF+ay2D3 gx8ZdiBgMxwHUVNilDHHbo1VLRHmtsvysYIB02cRtklV1SZm0KaADNuESnCSSWfz//kn MVgw== X-Forwarded-Encrypted: i=1; AJvYcCV8wkwmW8X8YAemGmPR3/H9OfAaTSJ0SuLccVrN8rzrj2UDG3LMigCp2sCluuZ97sbqvHjhhFgwHoBPTG/y@lists.postgresql.org X-Gm-Message-State: AOJu0YxotlypTik7Zu3/DKbKNYvTaE2bBFe8iVPnZF9BfPI0jf8OhAKx uA7cqdRifcBBMqcHKQL5tb2pPXfcUyDaVX6SP9ekNoOt6anDBP/L X-Gm-Gg: ASbGnctlUJsVGD/25RGbgiAXazikRMWGDl+IfeYyEOubmaFxRoib+RAjIkCyS01cLwF s1zELul3EIpTk3+cGAl64L/3p/dJAgvtsHtiKvXXL6+t3wKBWAXLrrzteZNGPp5LbS3eJn5d30u TzUedjLYEIkTWyC8L+seTQBBwWxdCh442ACPEcRRFYXiWUI3+0JjRjCmt5HDlZJuLbKAoYX5Dm3 kJp6/3kaNrrBFK+sILIluyjfuCO/3ktJNEIa28u7CvnMO4Uc40/oYCukhVerf3QWmmafjSfL/wd kU2WnQ8W4JOSI/xWO9g151VkuvkscaRgC/kSSEV0LbzhRW+/C9P28YRL3zs+qGIn5A3CXcFqGiQ JFZI= X-Google-Smtp-Source: AGHT+IGx2ohGsklNf0VnoazOeXVlph7S6HUeCk54oYDM0j3po+14zveclmJ8ZT/39lp+KhHLZmKkCg== X-Received: by 2002:a05:600c:1910:b0:43b:cc3c:60bc with SMTP id 5b1f17b1804b1-43d3b98e784mr15148985e9.15.1742299330228; Tue, 18 Mar 2025 05:02:10 -0700 (PDT) Received: from [192.168.0.89] (84.123.232.230.dyn.user.ono.com. [84.123.232.230]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d1fe659b3sm131118135e9.34.2025.03.18.05.02.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Mar 2025 05:02:09 -0700 (PDT) Message-ID: <760b4c92-6790-40e1-8a2b-631744a51433@gmail.com> Date: Tue, 18 Mar 2025 13:02:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: making EXPLAIN extensible To: Robert Haas Cc: Jeff Davis , Thom Brown , PostgreSQL Hackers , Tom Lane References: <5bbca514250c1f8ee45f08ada94184b0ae109fe9.camel@j-davis.com> <82f96eed213c8d76b36b8a3f504576e5af493270.camel@j-davis.com> <339167.1741200807@sss.pgh.pa.us> <476382.1741208421@sss.pgh.pa.us> <480078.1741210736@sss.pgh.pa.us> <899469.1741295787@sss.pgh.pa.us> Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/7/25 16:05, Robert Haas wrote: I have attempted to use hooks, proposed in 0002, in my extensions. At first, it worked great. My patch reduced a lot, and the only things that I need in the planner to improve its predictions are the selectivity hook and the create_plan hook - the last one needed to pass data from the best_path chosen to the plan and needed to compare prediction and reality at the end of execution. Some questions: 1. I think, hooks ExplainOneQuery_hook_type, explain_per_plan_hook_type, explain_per_node_hook_type deserve to be moved to explain_format.h At least, inside the hook, we usually use functions like ExplainProperty. 2. In my patch I inserted the hook before the line 1894: /* in text format, the first line ends here */ Why have you chosen a different way? I don't have specific reasons to insist, except the extension data right under the node looks better to me personally. Some changes of the explain format have already been made in the current master. Applying this proposal now would reduce additional work for extension (and fork) maintainers in the next version. -- regards, Andrei Lepikhov