Re: [PG13] Planning (time + buffers) data structure in explain plan (format text)

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Pierre Giraud <pierre(dot)giraud(at)dalibo(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Fujii Masao <fujii(at)postgresql(dot)org>
Subject: Re: [PG13] Planning (time + buffers) data structure in explain plan (format text)
Date: 2020-08-19 09:04:29
Message-ID: 20200819090429.s7hoyyw4a6jumgkc@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 19, 2020 at 08:49:48PM +1200, David Rowley wrote:
> On Wed, 19 Aug 2020 at 19:22, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
> > Hearing no objection, here's a patch to change the output as suggested by
> > Pierre:
> >
> > =# explain (analyze, buffers) select * from pg_class;
> > QUERY PLAN >
> > ------------------------------------------------------------------------------------------------------->
> > Seq Scan on pg_class (cost=0.00..16.86 rows=386 width=265) (actual time=0.020..0.561 rows=386 loops=1)
> > Buffers: shared hit=9 read=4
> > Planning:
> > Planning Time: 4.345 ms
> > Buffers: shared hit=103 read=12
> > Execution Time: 1.447 ms
> > (6 rows)
>
> I don't really have anything to say about the change in format, but on
> looking at the feature, I do find it strange that I need to specify
> ANALYZE to get EXPLAIN to output the buffer information for the
> planner.
>
> I'd expect that EXPLAIN (BUFFERS) would work just fine, but I get:
>
> ERROR: EXPLAIN option BUFFERS requires ANALYZE
>
> Ths docs [1] also mention this is disallowed per:
>
> "This parameter may only be used when ANALYZE is also enabled."
>
> I just don't agree that it should be. What if I want to get an
> indication of why the planner is slow but I don't want to wait for the
> query to execute? or don't want to execute it at all, say it's a
> DELETE!

I quite agree, this restriction is unhelpful since we have planning buffer
information.

>
> It looks like we'd need to make BUFFERS imply SUMMARY

+1

>
> However, I'm not quite sure how we should handle if someone does:
> EXPLAIN (BUFFERS on, SUMMARY off). Without the summary, there's no
> place to print the buffers, which seems bad as they asked for buffers.

But this won't be as much a problem if ANALYZE is asked, and having different
behaviors isn't appealing. So maybe it's better to let people get what they
asked for even if that's contradictory?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-08-19 09:12:02 Re: Creating a function for exposing memory usage of backend process
Previous Message David Rowley 2020-08-19 08:49:48 Re: [PG13] Planning (time + buffers) data structure in explain plan (format text)