Re: CPU time for pg_stat_statement

From: Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CPU time for pg_stat_statement
Date: 2022-05-20 21:32:47
Message-ID: CANtu0og2w9WSknTH17VnRJ5jDyv9bzSHGCmjRxnBDWcEDnNvKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, Tom.

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

I'll try to use pg_stat_kcache to check the difference between Wall
and CPU for my case.

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

My idea was to not replace wall-clock (clock_gettime) by cpu-clock (getrusage).
I think about adding getrusage as an additional column (with flag to
enable actual measuring).
Looks like I need to be more precise in words :)

It is just two different clocks - and sometimes you need physical
time, sometimes CPU time (and sometimes, for example, amount of WAL
written).

Best regards,
Michail.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-05-20 21:45:19 Re: Add --{no-,}bypassrls flags to createuser
Previous Message Michail Nikolaev 2022-05-20 21:21:49 Re: CPU time for pg_stat_statement