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 1t2E22-002XMv-A2 for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2024 18:18:30 +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 1t2E1z-006CWN-0l for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2024 18:18:27 +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 1t2E1y-006CVD-KU for pgsql-general@lists.postgresql.org; Sat, 19 Oct 2024 18:18:27 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t2E1w-001wQF-6a for pgsql-general@postgresql.org; Sat, 19 Oct 2024 18:18:26 +0000 Received: by mail-ed1-x543.google.com with SMTP id 4fb4d7f45d1cf-5c9552d02e6so3843858a12.2 for ; Sat, 19 Oct 2024 11:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729361903; x=1729966703; 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=TQkxyTlG6hXNjFsmPvSbK7/ep4SKI2dhb74jtMUDDxo=; b=IV7pheoCyzg5zFY+giofGP8t427bcpeFw2PeKJjurDmK6okX14ngpaVHQPcZXEK6Ns OxqYfigKC1BMsDcD9l9f4f68LBHeu8m82MhOeulqVSWDVfYLXHXPunNsmpN65eB9Jium aqfqBvN3q09BocGO5woweUnZkmkK/+qxXZnupBVSY4VTJgPn2zXiZDA7vbtvv3hBbxWj SKeqGr7pAoHApzmQlAONipYARajcpQSUFsXKX20DAgrsvaftD+oOYVPtXAZRwFdayy0d 0efovC52uPMJit5ZxszGqzFhZ2IpZJuUGnr5PUPZcLo7D+5r1V1IZ4IPhwV53uIQeNno T80w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729361903; x=1729966703; 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=TQkxyTlG6hXNjFsmPvSbK7/ep4SKI2dhb74jtMUDDxo=; b=Q46ew0DT9lnKjFERzPHxI7934HSiBJ5VAcRRpD4oxL/ypHis/V0I+fxYuqqjcZZGEG NC7RTj2plwCE7bQWO9C4HcPOGh7oBeYbfPmOEqYzJfuFNJVuD7eWLFdr0ZM0wOZ2MvXW kcXTMzEcecGBBsF35Kruv/MI0VQGyMhQT4ojXHdUhkqQqdmiWo3maCQ2Y7J8UAmQohPX Y8oFDOgrqlby5KttlgdqOg4Og29y1BnvbpBzSUZ8cFF+CGZbCGI8n3sACnqBet6ILMGx AiQz+G3szqFISiwiKO5umRkjNdgM7LjNVX4f+h60EkE8nYZ2PjHMSSrM0LZk9qNz+t7O BfbQ== X-Forwarded-Encrypted: i=1; AJvYcCVfHJ8Pl6CyYXKtowfIweRkZ1Ri3/vz7ikjpE/j2uuYw+G2QsxgefcRPdimRU6+gPe+GocLjDmNavml3BdA@postgresql.org X-Gm-Message-State: AOJu0YxwsYLwdlasoeI4+nIf1rdugDTYzF1gF8Z3YELb4ucTzHyIYz9N cohBG42udiWAAHnGHTpzPbIGml+1zAAWgHn5FoJMw/iDtXYur6nfgrrxbHoDMx7PEkPGqNIwniG ara6J+6GwihA9qTbckBiyInEwyRg= X-Google-Smtp-Source: AGHT+IGYiRvtBMcxf3vEhU1lU0HpZUANpNzvLlUZVUfDGgA5bpXTEPDScm4WebCLMgtqKDFZUWK8uCMrP/6ZDhIEvaU= X-Received: by 2002:a05:6402:4014:b0:5c9:3889:4d5 with SMTP id 4fb4d7f45d1cf-5ca0ae87f87mr4660862a12.25.1729361902907; Sat, 19 Oct 2024 11:18:22 -0700 (PDT) MIME-Version: 1.0 References: <1128627.1729360916@sss.pgh.pa.us> In-Reply-To: <1128627.1729360916@sss.pgh.pa.us> From: Vijaykumar Jain Date: Sat, 19 Oct 2024 23:48:12 +0530 Message-ID: Subject: Re: explain vs auto_explain To: Tom Lane Cc: "David G. Johnston" , pgsql-general Content-Type: multipart/alternative; boundary="000000000000e940e80624d871f7" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e940e80624d871f7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 19 Oct 2024 at 23:31, Tom Lane wrote: > "David G. Johnston" writes: > > On Sat, Oct 19, 2024 at 10:43=E2=80=AFAM Vijaykumar Jain < > > vijaykumarjain.github@gmail.com> wrote: > >> i tried to check the code for auto_explain , there is nothing that hel= ps > >> understand why it was provided as a separate . > > > Probably because output to log was easier than reworking the internals = to > > make output to client happen. > > The reason that auto_explain exists is to capture plans for queries > that are being issued by real applications --- which aren't programmed > to issue EXPLAIN for themselves, and likely don't have a good place to > put the data if they did. Also, auto_explain can capture runtime > details for queries that are really being executed and delivering > results, whereas EXPLAIN ANALYZE doesn't deliver the query results and > thus can't be shoehorned into real applications. So it's partly a > matter of not having a protocol spec that would allow the EXPLAIN data > to be delivered on a side channel, but mostly a recognition that > rewriting applications to capture such data would be painful. > > regards, tom lane > ok, it makes sense for the reason of having auto_explain. but maybe i did ask correctly, why do we not have the extended flags in auto_explain , in , explain wrt nested_statements, and triggers ... a user who finds the console output complicated, could well use a pager or redirect the output to the file via \o which is client side. as i mentioned the reason is, there are differences on what auto_explain captures and what explain does... and the dev user is not able to see the difference without having access to logs. for example , iirc refresh materialised view does not show the plan , although there was once a feature reported, which showed the difference in support for parallelism. ex in this discussion Thread: CREATE/REFRESH MATERIALIZED VIEW planner difference? : Postgres Professional i dont expect this to be a feature request or something, it was just that i wanted to be aware why there are differences, because the cloud guys have strict control over logs as it has many other things, so they just wont give access at all. --=20 Thanks, Vijay Open to work Resume - Vijaykumar Jain --000000000000e940e80624d871f7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sat, 19 Oct 2024 = at 23:31, Tom Lane <tgl@sss.pgh.pa.= us> wrote:
david.g.johnston@gmail.com> writes:
> On Sat, Oct 19, 2024 at 10:43=E2=80=AFAM Vijaykumar Jain <
> v= ijaykumarjain.github@gmail.com> wrote:
>> i tried to check the code for auto_explain , there is nothing that= helps
>> understand why it was provided as a separate .

> Probably because output to log was easier than reworking the internals= to
> make output to client happen.

The reason that auto_explain exists is to capture plans for queries
that are being issued by real applications --- which aren't programmed<= br> to issue EXPLAIN for themselves, and likely don't have a good place to<= br> put the data if they did.=C2=A0 Also, auto_explain can capture runtime
details for queries that are really being executed and delivering
results, whereas EXPLAIN ANALYZE doesn't deliver the query results and<= br> thus can't be shoehorned into real applications.=C2=A0 So it's part= ly a
matter of not having a protocol spec that would allow the EXPLAIN data
to be delivered on a side channel, but mostly a recognition that
rewriting applications to capture such data would be painful.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane

ok, it makes sense for the reason= of having auto_explain. but maybe i did ask correctly,=C2=A0
why= do we not have the extended flags in auto_explain , in , explain wrt neste= d_statements, and triggers ...
a user who finds the console outpu= t complicated, could well use a pager or redirect the output to the file vi= a \o which is client side.

as i mentioned the reas= on is, there are differences on what auto_explain captures and what explain= does... and the dev user is not able to see the difference
witho= ut having access to logs.
for example , iirc=C2=A0
refr= esh materialised view does not show the plan , although there was once a fe= ature reported, which showed the difference in support for parallelism.
ex in this discussion

i dont expect= this to be a feature request or something, it was just that i wanted to be= aware why there are differences,
=C2=A0because the cloud guys ha= ve strict control over logs as it has many other things, so they just wont= =C2=A0give access at all.


--
Thanks,
Vijay

Open to = work
Resume -=C2=A0Vijaykumar Jain
--000000000000e940e80624d871f7--