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 1rh7dO-009iT6-C7 for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2024 12:41:34 +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 1rh7dM-007asX-RZ for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Mar 2024 12:41:33 +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 1rh7dM-007asO-I4 for pgsql-hackers@lists.postgresql.org; Mon, 04 Mar 2024 12:41:33 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rh7dJ-002icR-PN for pgsql-hackers@lists.postgresql.org; Mon, 04 Mar 2024 12:41:32 +0000 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5dcc4076c13so3264707a12.0 for ; Mon, 04 Mar 2024 04:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=timescale.com; s=google; t=1709556088; x=1710160888; 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=eROzuzxZnKNBw35435WxjhKzvCxvhkrM+KciijOaBC8=; b=f69BE+7hbt8qNbcXdFs6GOg6oMWXYJO6bXgMlm/N71unR1Hh2Qpvr4iYD26Z1ZZJTd CdSs7lxUbyx3BiqOpUALv2THMBbAIjD8AP6mCN5GQFosLwhTTjVCF9zBP3wC3YJVRsrD X7lN2m5PejTF5u6KeHKx5Gh4Khy1+STXQzq6cwfsT/aMhLlX+PKDucKzCkcPXNuLxaOG q5kyIyKydwcFNKv1b3Rkbp464Z7phVyhTDn7eaMGqzmVLGCEjuo6B5u28bc5fGNf4d4n EYkWDX2sXy1lvVSTANaF/dWUP6lMxxE+gnpG4Gsql05Hmcw1s78rh6Az6vAm7CPDcC/S RcoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709556088; x=1710160888; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eROzuzxZnKNBw35435WxjhKzvCxvhkrM+KciijOaBC8=; b=IRvT9YD1ZI/f4I8A/xoDmx0t6xJ/VV/H0GPb4yGpLHS6PPb0FV4ukHWTf8+nU7B66b bMejho4YYU236j7N4FFQHTZIM06yJEuKZFnsTeEtDLyAljG1BBeBJsQ3jhB8MYcX9JRh weNScc7cvpvrevyLVnD/RtY1KFZB/oJtodi8peMD/NeWl//CIEDWgH2EuCKRilAaY1gC yVFmIIz/J26n8319NBUktJK5iZNeFZvD107ebSVjG+KLbctZI3E6w+LrYg+AYMDmTaxV aRnzE55Wu4dkZFhjAZoyMH5DLRgD8W/iOCfkQIxdyxSON/GA8a+0akyYUVeoGc8nQp1c x77w== X-Gm-Message-State: AOJu0YyEWwNQaFBsdLyao2JvT3152sTgCDenlmGSUlp6dUpkMZ3wB1DQ 66gLIjzidWOdIVATQEwq5wyx+K2j2vQ2lJcwL5o0YJM0lUHBd3zbWHllPl8cdQeNFbFnKYJkPLq 8D8ZwWRo60Wn1cxg3EKN+S8wWEgS1I5YpA5+8Mi1YTZ0cdVQkQzjBMg== X-Google-Smtp-Source: AGHT+IHzj0hpYa6dzm4uQmbANBI6I0A8+WJ8Qd4P0SNmXilbWQjYVugshk3Zkit4XFlgj0zCaYy3bGEH7ZC4btLbsn0= X-Received: by 2002:a17:90a:3fc6:b0:29b:789:28d0 with SMTP id u6-20020a17090a3fc600b0029b078928d0mr11339241pjm.22.1709556087864; Mon, 04 Mar 2024 04:41:27 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Aleksander Alekseev Date: Mon, 4 Mar 2024 15:41:16 +0300 Message-ID: Subject: Re: Hooking into ExplainOneQuery() complicated by missing standard_ExplainOneQuery To: pgsql-hackers@lists.postgresql.org Cc: Mats Kindahl 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 Hi, > I wanted to hook into the EXPLAIN output for queries and add some extra i= nformation, but since there is no standard_ExplainOneQuery() I had to copy = the code and create my own version. > > Since the pattern with other hooks for a function WhateverFunction() seem= s to be that there is a standard_WhateverFunction() for each WhateverFuncti= on_hook, I created a patch to follow this pattern for your consideration. > > I was also considering adding a callback so that you can annotate any nod= e with explanatory information that is not a custom scan node. This could b= e used to propagate and summarize information from custom scan nodes, but I= had no immediate use for that so did not add it here. I would still be int= erested in hearing if you think this is something that would be useful to t= he community. Thanks for the patch. LGTM. I registered the patch on the nearest open CF [1] and marked it as RfC. It is a pretty straightforward refactoring. [1]: https://commitfest.postgresql.org/48/4879/ --=20 Best regards, Aleksander Alekseev