CPU time for pg_stat_statement

Поиск
Список
Период
Сортировка
От Michail Nikolaev
Тема CPU time for pg_stat_statement
Дата
Msg-id CANtu0ohSj7nOtJ_DVErt3b5Yj34eufQ=2Wv=aTqrExJ0FvP+Ag@mail.gmail.com
обсуждение исходный текст
Ответы Re: CPU time for pg_stat_statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: CPU time for pg_stat_statement  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers
Hello, hackers.

Today I was doing some aggregates over pg_stat_statements in order to
find types of queries consuming most of the CPU. Aggregates were made
on two pg_state_statement snapshots within 30 sec delay.

The sum(total_time) had the biggest value for a very frequent query
with about 10ms execution. I was thinking it is the biggest CPU
consumer.

But after reducing the frequency of queries a lot I was unable to see
any significant difference in server CPU usage...

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).

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.

I am probably able to prepare the patch, but it is always better to
get some feedback on the idea first :)

Best regards,
Michail.



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

Предыдущее
От: Zhihong Yu
Дата:
Сообщение: check for null value before looking up the hash function
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Limiting memory allocation