On Sat, Apr 25, 2015 at 4:23 PM, Julien Rouhaud wrote: > There are at least two projects that provides this kind of statistics > for backends: pg_proctab (https://github.com/markwkm/pg_proctab) and > pg_stat_kcache (https://github.com/dalibo/pg_stat_kcache). Michael also > wrote an article on this topic some weeks ago > (http://michael.otacoo.com/postgresql-2/postgres-calculate-cpu-usage-process/).
Don't use that hack except for development purposes ;) pg_stat_kcache gives shows that core has enough facility for an extension doing query-base CPU statistics by using the two hooks at executor init and end with two calls to getrusage to calculate diffs for the stats it needs. pg_proctab is useful as well to get live data. -- Michael -- Sent via pgsql-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
