Skip to content

Commit

Permalink
When running --action bloat, indexes names are not fully qualified so…
Browse files Browse the repository at this point in the history
… it's

hard, or imposible to know which index is bloated if there are indexes
with the same name in different schemas.

Here we add the schema to the bloat message when finding bloat in indexes.
  • Loading branch information
martinmarques committed Jun 4, 2015
1 parent 099a599 commit d039829
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions check_postgres.pl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ package check_postgres;
'backends-oknone' => q{No connections},
'backends-po' => q{sorry, too many clients already},
'backends-users' => q{$1 for number of users must be a number or percentage},
'bloat-index' => q{(db $1) index $2 rows:$3 pages:$4 shouldbe:$5 ($6X) wasted bytes:$7 ($8)},
'bloat-index' => q{(db $1) index $2.$3 rows:$4 pages:$5 shouldbe:$6 ($7X) wasted bytes:$8 ($9)},
'bloat-nomin' => q{no relations meet the minimum bloat criteria},
'bloat-table' => q{(db $1) table $2.$3 rows:$4 pages:$5 shouldbe:$6 ($7X) wasted size:$8 ($9)},
'bug-report' => q{Please report these details to [email protected]:},
Expand Down Expand Up @@ -3755,14 +3755,14 @@ sub check_bloat {

## Now the index, if it exists
if ($index ne '?') {
my $nicename = perfname($index);
my $nicename = perfname("$schema.$index");
$perf{$iwb}{$nicename}++;
my $msg = msg('bloat-index', $dbname, $index, $irows, $ipages, $iotta, $ibloat, $iwb, $iws);
my $msg = msg('bloat-index', $dbname, $schema, $index, $irows, $ipages, $iotta, $ibloat, $iwb, $iws);
my $ok = 1;
my $iperbloat = $ibloat * 100;

if ($MRTG) {
$stats{index}{"DB=$dbname INDEX=$index"} = [$iwb, $ibloat];
$stats{index}{"DB=$dbname INDEX=$schema.$index"} = [$iwb, $ibloat];
next;
}
if ($critical->($iwb, $iperbloat)) {
Expand Down

0 comments on commit d039829

Please sign in to comment.