function dba_pgsql_report_status in Database Administration 7
Status. TODO: http://www.postgresql.org/docs/current/static/monitoring-stats.html For example: SELECT * FROM pg_stat_bgwriter;
File
- database/
pgsql.report.inc, line 35
Code
function dba_pgsql_report_status($data) {
$status = new stdClass();
// Active connections
$result = db_query('SELECT COUNT(*) FROM pg_stat_activity')
->fetch();
$status->connections = $result->count;
// Locks
$result = db_query('SELECT COUNT(*) FROM pg_locks WHERE granted = TRUE')
->fetch();
$status->locks_held = $result->count;
$result = db_query('SELECT COUNT(*) FROM pg_locks WHERE granted = FALSE')
->fetch();
$status->locks_wait = $result->count;
$status->locks_total = $status->locks_wait + $status->locks_held;
return $status;
}