On Fri, Jul 13, 2018 at 9:23 AM, Adrien NAYRAT <adrien.nayrat@xxxxxxxxxxxx> wrote: > 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. >> Also no one asked for it before, but we can definitely add all the other fields returned by get_rusage(2) in pg_stat_kcache. You can also look at https://github.com/markwkm/pg_proctab.