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

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Julien Rouhaud <rjuju123@gmail.com>, Justin Pryzby <pryzby@telsasoft.com>, Pierre Giraud <pierre.giraud@dalibo.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>, Fujii Masao <fujii@postgresql.org>
Date: 2020-08-19T23:33:34Z
Lists: pgsql-hackers
On Thu, 20 Aug 2020 at 03:31, Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>
>
>
> On 2020/08/19 19:39, David Rowley wrote:
> > On Wed, 19 Aug 2020 at 21:05, Julien Rouhaud <rjuju123@gmail.com> wrote:
> >>
> >> On Wed, Aug 19, 2020 at 08:49:48PM +1200, David Rowley wrote:
> >>> 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?
> >
> > I'd say BUFFERS on, BUFFERS off is contradictory. I don't think
> > BUFFERS, SUMMARY OFF is. It's just that we show the buffer details for
> > the planner in the summary.  Since "summary" is not exactly a word
> > that describes what you're asking EXPLAIN to do, I wouldn't blame
> > users if they got confused as to why their BUFFERS on request was not
> > displayed.
>
> Displaying the planner's buffer usage under summary is the root cause of
> the confusion? If so, what about displaying that outside summary?
> Attached is the POC patch that I'm just thinking.

I had a look at this and I like it better than what I proposed earlier.

The change to show_buffer_usage() is a bit ugly, but I'm not really
seeing a better way to do it. Perhaps that can be improved later if we
ever find that there's some other special case to add.

David



Commits

  1. Fix explain regression test failure.

  2. Rework EXPLAIN for planner's buffer usage.