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 1t2DDA-002TSl-K9 for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2024 17:25:56 +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 1t2DD8-005TR2-SA for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2024 17:25:55 +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.94.2) (envelope-from ) id 1t2DD8-005TQq-F0 for pgsql-general@lists.postgresql.org; Sat, 19 Oct 2024 17:25:54 +0000 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t2DD2-001j0p-18 for pgsql-general@postgresql.org; Sat, 19 Oct 2024 17:25:53 +0000 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5eb9ee4f14cso379499eaf.1 for ; Sat, 19 Oct 2024 10:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729358747; x=1729963547; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=J2yC7oHHMHy/mJGUDuZSrLyu9bMk6RGnOVK8Q2fHgQw=; b=eS9kdmnbSbz7brR4ckHRE5xVpbOe3lTlYaLF+/Tw9vYyfUyzosiY7a7+mA0mYnjRJ7 J33XFsRh96rGzcaeG8EFHFgmoEtqOA9YzP9+Tig+S6ehvYhX2TgMrjxp9rwjB89GXOvy zEbPMdX3/pk3fJBDh7ryxxx6MDiSycakSIYvCKP9JmNL8VWQI74jiYg2jLbZE2iN6tLf yidbmPJdKuA6NqFkhmVVUNi0b+5Ncav9xITPYYUBLbw8326m0sDFaZQe6ZN7YAmiyDD+ 6dZQ2ZSXFr0ba7KD9R0FpcJvbrHLtgEPaBYDa5bjczYhEnkBlYmZ3zXiVwqd6JwgttC8 7+GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729358747; x=1729963547; h=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=J2yC7oHHMHy/mJGUDuZSrLyu9bMk6RGnOVK8Q2fHgQw=; b=eKbn13nhD7HH9okxos4IZkOYXPMGZDprxHefQzN/K5SOTX6f0Bt3gkexbbthPmMk5D vb4KoQaczi9dILuk5UOqCCqMIolpgxUNPgCQ9w58x7Mvla2Yb42Uw9tHUmpNWrUpIGRL ZhMyB4JiJna3G12defI+tydJALTDj3liu9oPzMryPcFP+4LcQWv0vIl/qA4JuB6CG3UQ OMU38SrOWjZOw9sQJ4pRFZUuHmOs9CInkdlb1klINUoMwZdZajxrkm/5t1HpKUYubkpR j9qWi7G7xyJ3NNybm+AeT4nDapQZLlpBZ9QtM6gbIaCHsgs3KPOVfgZnyulirS7MX/uC jlmA== X-Gm-Message-State: AOJu0YzL2RLfj2VRlvcuQljRXjkuVvMw+iB4Rpmln2IYrEZ20LvfvqDW DoQdJySNJ4uBLFPyMRaw9m7/nq9CvldrGSVmEFuiDUbJminDo20x81113IgSGX3km6UXRXEIcvq mh0hE3MixZi0WFd5ZHrKcCXEwD7w= X-Google-Smtp-Source: AGHT+IFrmy4hFUxvHgWvUqt60w03//Gi7O1agfHOLkFrgGnV4twU1bTu6qWYomxfzAioOanJmE3d2CA9lO3vojaKoF0= X-Received: by 2002:a05:6870:a10b:b0:288:59d3:2a03 with SMTP id 586e51a60fabf-2892c59bb02mr5651351fac.39.1729358747073; Sat, 19 Oct 2024 10:25:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "David G. Johnston" Date: Sat, 19 Oct 2024 10:25:09 -0700 Message-ID: Subject: Re: explain vs auto_explain To: Vijaykumar Jain Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000cf04b80624d7b5ed" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cf04b80624d7b5ed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Oct 19, 2024 at 10:05=E2=80=AFAM Vijaykumar Jain < vijaykumarjain.github@gmail.com> wrote: > Why does auto_explain have extended flags to support nested statements an= d > triggers whereas explain does not. > the objects of concern have the same ownership and access, so it does not > even sound like a security thing. > > or maybe it is just a format/display issue ? > i tried to check the doc, there is no explicit mention of differences > PostgreSQL: Documentation: 17: F.3. auto_explain =E2=80=94 log execution = plans of > slow queries > > With auto_explain you end up producing multiple individual explains, one for each top-level query being executed. Each one produced by auto_explain which hooks into the point where a top-level query begins execution. Running explain directly on a top-level query doesn't establish any of the needed hooks to produce these additional explains. While those hooks could be installed the output for manual explain is the single query result sent to the client. How multiple explains could be combined into that single output channel would need to be figured out as well. While auto_explain uses the log file which is much simpler to use in this manner since each auto_explain can just be told to write its output to the log and not worry about any other considerations. In short, there is no fundamental reason manual explain couldn't be improved along these lines. David J. --000000000000cf04b80624d7b5ed Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Oct 19, 2024 at 10:05=E2=80=AFAM Vijaykumar Jain &= lt;vijaykumarjain.github= @gmail.com> wrote:
Why does auto_explain have exte= nded flags to support nested statements and triggers whereas explain does n= ot.
the objects of concern have the same ownership and access, so= it does not even sound like a security thing.

or = maybe it is just a format/display issue ?=C2=A0
i tried to check = the doc, there is no explicit mention of differences=C2=A0

<= /div>

With auto_explain you end up producing = multiple individual explains, one for each top-level query being executed.= =C2=A0 Each one produced by auto_explain which hooks into the point where a= top-level query begins execution.=C2=A0 Running explain directly on a top-= level query doesn't establish any of the needed hooks to produce these = additional explains.=C2=A0 While those hooks could be installed the output = for manual explain is the single query result sent to the client.=C2=A0 How= multiple explains could be combined into that single output channel would = need to be figured out as well.=C2=A0 While auto_explain uses the log file = which is much simpler to use in this manner since each auto_explain can jus= t be told to write its output to the log and not worry about any other cons= iderations.

In short, there is no fundamental reason m= anual explain couldn't be improved along these lines.

David J.

--000000000000cf04b80624d7b5ed--