Skip to content

Commit d039829

Browse files
committed
When running --action bloat, indexes names are not fully qualified so 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.
1 parent 099a599 commit d039829

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

check_postgres.pl

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ package check_postgres;
9797
'backends-oknone' => q{No connections},
9898
'backends-po' => q{sorry, too many clients already},
9999
'backends-users' => q{$1 for number of users must be a number or percentage},
100-
'bloat-index' => q{(db $1) index $2 rows:$3 pages:$4 shouldbe:$5 ($6X) wasted bytes:$7 ($8)},
100+
'bloat-index' => q{(db $1) index $2.$3 rows:$4 pages:$5 shouldbe:$6 ($7X) wasted bytes:$8 ($9)},
101101
'bloat-nomin' => q{no relations meet the minimum bloat criteria},
102102
'bloat-table' => q{(db $1) table $2.$3 rows:$4 pages:$5 shouldbe:$6 ($7X) wasted size:$8 ($9)},
103103
'bug-report' => q{Please report these details to [email protected]:},
@@ -3755,14 +3755,14 @@ sub check_bloat {
37553755

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

37643764
if ($MRTG) {
3765-
$stats{index}{"DB=$dbname INDEX=$index"} = [$iwb, $ibloat];
3765+
$stats{index}{"DB=$dbname INDEX=$schema.$index"} = [$iwb, $ibloat];
37663766
next;
37673767
}
37683768
if ($critical->($iwb, $iperbloat)) {

0 commit comments

Comments
 (0)