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

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: [PG13] Planning (time + buffers) data structure in explain plan (format text)
Дата
Msg-id e7361ab4-5b6b-9667-e25b-04ae0b070ded@oss.nttdata.com
обсуждение исходный текст
Ответ на Re: [PG13] Planning (time + buffers) data structure in explain plan (format text)  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: [PG13] Planning (time + buffers) data structure in explain plan (format text)  (David Rowley <dgrowleyml@gmail.com>)
Re: [PG13] Planning (time + buffers) data structure in explain plan (format text)  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers

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.

With the patch, for example, whatever "summary" settng is, "buffers on"
displays the planner's buffer usage if it happens.

=# explain (buffers on, summary off) select * from t;
                      QUERY PLAN
-----------------------------------------------------
  Seq Scan on t  (cost=0.00..32.60 rows=2260 width=8)
  Planning:
    Buffers: shared hit=16 read=6
(3 rows)


If "summary" is enabled, the planning time is also displayed.

=# explain (buffers on, summary on) select * from t;
                      QUERY PLAN
-----------------------------------------------------
  Seq Scan on t  (cost=0.00..32.60 rows=2260 width=8)
  Planning:
    Buffers: shared hit=16 read=6
  Planning Time: 0.904 ms
(4 rows)


If the planner's buffer usage doesn't happen, it's not displayed
(in text format).

=# explain (buffers on, summary on) select * from t;
                      QUERY PLAN
-----------------------------------------------------
  Seq Scan on t  (cost=0.00..32.60 rows=2260 width=8)
  Planning Time: 0.064 ms
(2 rows)

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: ahsan hadi
Дата:
Сообщение: Re: Performing partition pruning using row value
Следующее
От: Tom Lane
Дата:
Сообщение: Re: stress test for parallel workers