Re: CPU time for pg_stat_statement

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: CPU time for pg_stat_statement
Дата
Msg-id 488810.1653079169@sss.pgh.pa.us
обсуждение исходный текст
Ответ на CPU time for pg_stat_statement  (Michail Nikolaev <michail.nikolaev@gmail.com>)
Ответы Re: CPU time for pg_stat_statement  (Michail Nikolaev <michail.nikolaev@gmail.com>)
Список pgsql-hackers
Michail Nikolaev <michail.nikolaev@gmail.com> writes:
> So, looks like clock_gettime is not so accurate to measure real CPU
> usage for some OLTP workloads. I suppose it is caused by the wall time
> vs CPU time difference (IO, thread switch, etc).

This is a pretty broad claim to make on the basis of one undocumented
test case on one unmentioned platform.

> But what do you think about adding cpu_time (by calling getrusage) to
> pg_stat_statements? Seems it could be very useful for CPU profiling.

On what grounds do you claim getrusage will be better?  One thing we
can be pretty certain of is that it will be slower, since it has to
return many more pieces of information.  And the API for it only allows
time info to be specified to microseconds, versus nanoseconds for
clock_gettime, so it's also going to be taking a precision hit.

            regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: check for null value before looking up the hash function
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: CPU time for pg_stat_statement