From: Greg Sabino Mullane Date: Sat, 21 Feb 2009 15:02:25 +0000 (-0500) Subject: Always show all databases in the perf output, and order them, per suggestion by Cédri... X-Git-Tag: 2.9.0~158 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=4c3a7e9d4b20412ac2c7ee7474eaa3051a5baecf;p=check_postgres.git Always show all databases in the perf output, and order them, per suggestion by Cédric Villemain --- 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 <> ''} : ''; 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