diff options
author | Greg Sabino Mullane | 2009-02-21 15:02:25 +0000 |
---|---|---|
committer | Greg Sabino Mullane | 2009-02-21 15:02:25 +0000 |
commit | 4c3a7e9d4b20412ac2c7ee7474eaa3051a5baecf (patch) | |
tree | a0125018579a8da9e4919e6cceb84795f7ddafbb | |
parent | 5aca9de648843b8e5a145a0eb71e87980255739d (diff) |
Always show all databases in the perf output, and order them, per suggestion by Cédric Villemain
-rwxr-xr-x | check_postgres.pl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/check_postgres.pl b/check_postgres.pl index 8e8b7f3d6..1d114a1f2 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -2092,7 +2092,8 @@ sub check_backends { my $MAXSQL = q{SELECT setting FROM pg_settings WHERE name = 'max_connections'}; my $NOIDLE = $noidle ? q{WHERE current_query <> '<IDLE>'} : ''; my $GROUPBY = q{GROUP BY 2,3}; - $SQL = "SELECT COUNT(*), ($MAXSQL), datname FROM pg_stat_activity $NOIDLE $GROUPBY"; + $SQL = "SELECT COUNT(datid), ($MAXSQL), d.datname FROM pg_database d ". + "LEFT JOIN pg_stat_activity s ON (s.datid = d.oid) $NOIDLE $GROUPBY ORDER BY datname"; my $info = run_command($SQL, {regex => qr[\s*\d+ \| \d+\s+\|] } ); ## There may be no entries returned if we catch pg_stat_activity at the right |