Re: Track IO times in pg_stat_io

Поиск
Список
Период
Сортировка
От Melanie Plageman
Тема Re: Track IO times in pg_stat_io
Дата
Msg-id CAAKRu_Z73gXmdkVX=ycvw2iTLZq69qy+N8YBLcKx2sjunWeBBw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Track IO times in pg_stat_io  (Andres Freund <andres@anarazel.de>)
Ответы Re: Track IO times in pg_stat_io  (Melanie Plageman <melanieplageman@gmail.com>)
Список pgsql-hackers
On Mon, Mar 20, 2023 at 10:34 PM Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2023-03-16 17:19:16 -0400, Melanie Plageman wrote:
> > > > > I wonder if we should get rid of pgStatBlockReadTime, pgStatBlockWriteTime,
> > > >
> > > > And then have pg_stat_reset_shared('io') reset pg_stat_database IO
> > > > stats?
> > >
> > > Yes.
> >
> > I think this makes sense but I am hesitant to do it in this patchset,
> > because it feels a bit hidden...maybe?
>
> I'd not do it in the same commit, but I don't see a problem with doing it in
> the same patchset.
>
> Now that I think about it again, this wouldn't make pg_stat_reset_shared('io')
> affect pg_stat_database - I was thinking we should use pgstat_io.c stats to
> provide the information for pgstat_database.c, using its own pending counter.

So, I've done this in the attached. But, won't resetting pgstat_database
be a bit weird if you have built up some IO timing in pending counters
and right after you reset a flush happens and then suddenly the values
are way above 0 again?

> > I considered refactoring pgstat_io_end() to use INSTR_TIME_ACCUM_DIFF()
> > like [1], but, in the end I actually think I would end up with more
> > operations because of the various different counters needing to be
> > updated. As it is now, I do a single subtract and a few adds (one for
> > each of the different statistics objects tracking IO times
> > (pgBufferUsage, pgStatBlockWrite/ReadTime). Whereas, I would need to do
> > an accum diff for every one of those.
>
> Right - that only INSTR_TIME_ACCUM_DIFF() only makes sense if there's just a
> single counter to update.
>
>
> WRT:
>                                 /* TODO: AFAICT, pgstat_count_buffer_write_time is only called */
>                                 /* for shared buffers whereas pgstat_count_buffer_read_time is */
>                                 /* called for temp relations and shared buffers. */
>                                 /*
>                                  * is this intentional and should I match current behavior or
>                                  * not?
>                                  */
>
> It's hard to see how that behaviour could be intentional.  Probably worth
> fixing in a separate patch. I don't think we're going to backpatch, but it
> would make this clearer nonetheless.


Attached v7 does this in separate commits.

Remaining feedback is about FlushLocalBuffers(). Is the idea simply to
get it into bufmgr.c because that is cleaner from an API perspective?

- Melanie

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Fix fseek() detection of unseekable files on WIN32
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry