Interesting, Hubert. Where/how do you get the data for: - number of transactions per second
periodically (every 5 minutes) i do: select sum(xact_commit) + sum(xact_rollback) from pg_stat_database and then just check against previous value, and calculate "per/second". this is actually handled nicely by mrtg itself.
- duration of longest query
select * from pg_stat_activity where current_query !~ '<IDLE>' order by query_start asc limit 1; this has some problems though, but are more or less easily avoidable.