On 07/13/2018 12:25 AM, Lukas Fittl wrote:
On Tue, Jul 10, 2018 at 11:38 AM, Justin Pryzby <pryzby@xxxxxxxxxxxxx
<mailto:pryzby@xxxxxxxxxxxxx>> wrote:
> 2. Make stats available in `pg_stat_statements` (or alternate view that
> could be joined on). The block stats are already available here, but
> others like CPU usage, page faults, and context switches are not.
pg_stat_statements is
./contrib/pg_stat_statements/pg_stat_statements.c which is 3k LOC.
getrusage stuff and log_*_stat stuff is in src/backend/tcop/postgres.c
Before you start implementing something here, take a look at
pg_stat_kcache [0]
Which already aims to collect a few more system statistics than what
pg_stat_statements provides today, and might be a good basis to extend from.
It might also be worth to look at pg_stat_activity wait event sampling
to determine where a system spends time, see e.g. pg_wait_sampling
[1] for one approach to this.
Hi,
You should look Powa stack :
https://github.com/powa-team/powa
Powa can aggregate metrics from different extensions such as
pg_stat_statements, pg_stat_kcache and pg_wait_sampling recently :
https://rjuju.github.io/postgresql/2018/07/09/wait-events-support-for-powa.html
Regards,
[0]: https://github.com/powa-team/pg_stat_kcache
<https://github.com/powa-team/pg_stat_kcache>
[1]: https://github.com/postgrespro/pg_wait_sampling
<https://github.com/postgrespro/pg_wait_sampling>
Best,
Lukas
--
Lukas Fittl