More tweaks to check_bloat and --include.
authorGreg Sabino Mullane <[email protected]>
Fri, 24 Jul 2009 01:19:13 +0000 (21:19 -0400)
committerGreg Sabino Mullane <[email protected]>
Fri, 24 Jul 2009 01:19:13 +0000 (21:19 -0400)
check_postgres.pl

index 69e47703346d13214265a4570ae2f92f4ba7174b..b85d2d7ac3f576ff516da90e7b8d8be09c1aacdd 100755 (executable)
@@ -2498,9 +2498,11 @@ FROM (
 
        if (! defined $opt{include}) {
                $SQL .= " WHERE sml.relpages - otta > $MINPAGES OR ipages - iotta > $MINIPAGES";
-               $SQL .= " LIMIT $LIMIT";
+               $SQL .= " ORDER BY wastedbytes DESC LIMIT $LIMIT";
+       }
+       else {
+               $SQL .= " ORDER BY wastedbytes DESC";
        }
-       $SQL .= " ORDER BY wastedbytes DESC";
 
        my $info = run_command($SQL);