Re: [Proposal] Add accumulated statistics for wait event

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [Proposal] Add accumulated statistics for wait event
Дата
Msg-id 20210614182721.425j3xvsiphoq6ty@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [Proposal] Add accumulated statistics for wait event  (Jehan-Guillaume de Rorthais <jgdr@dalibo.com>)
Ответы Re: [Proposal] Add accumulated statistics for wait event  (Andres Freund <andres@anarazel.de>)
Re: [Proposal] Add accumulated statistics for wait event  (Jehan-Guillaume de Rorthais <jgdr@dalibo.com>)
Список pgsql-hackers
Hi,

On 2021-06-14 16:10:32 +0200, Jehan-Guillaume de Rorthais wrote:
> In the patch in attachment, I tried to fix this by using kind of an internal
> hook for pgstat_report_wait_start and pgstat_report_wait_end. This allows to
> "instrument" wait events only when required, on the fly, dynamically.

That's *far worse*. You're adding an indirect function call. Which requires
loading a global variable and then a far call to a different function. You're
changing a path that's ~2 instructions with minimal dependencies (and no
branches (i.e. fully out of order executable) to something on the order of ~15
instructions with plenty dependencies and at least two branches (call, ret).

I doubt there's a path towards this feature without adding the necessary
infrastructure to hot-patch the code - which is obviously quite a
substantial project.

Greetings,

Andres Freund



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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Race condition in recovery?
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [Proposal] Add accumulated statistics for wait event