summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorRyan P. Kelly2012-05-17 22:10:34 +0000
committerRyan P. Kelly2012-05-17 22:10:34 +0000
commiteba4515da0ccb77160e2041436cfcc58d12ab1af (patch)
tree0dc0c30a931cab7c931e749bb625f0867af0d6c6 /check_postgres.pl
parent28887b91fd12111c32db75058c8a72ea5dabecbf (diff)
Restore totalwastedbytes
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl7
1 files changed, 6 insertions, 1 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 2a3e46b7d..7e03472fa 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -3527,7 +3527,12 @@ SELECT
ROUND(CASE WHEN iotta=0 OR ipages=0 OR ipages=iotta THEN 0.0 ELSE ipages/iotta::numeric END,1) AS ibloat,
CASE WHEN ipages < iotta THEN 0 ELSE ipages::bigint - iotta END AS wastedipages,
CASE WHEN ipages < iotta THEN 0 ELSE bs*(ipages-iotta) END AS wastedibytes,
- CASE WHEN ipages < iotta THEN '0 bytes' ELSE (bs*(ipages-iotta))::bigint || ' bytes' END AS wastedisize
+ CASE WHEN ipages < iotta THEN '0 bytes' ELSE (bs*(ipages-iotta))::bigint || ' bytes' END AS wastedisize,
+ CASE WHEN relpages < otta THEN
+ CASE WHEN ipages < iotta THEN 0 ELSE ipages-iotta::bigint END
+ ELSE CASE WHEN ipages < iotta THEN relpages-otta::bigint
+ ELSE relpages-otta::bigint + ipages-iotta::bigint END
+ END AS totalwastedbytes
FROM (
SELECT
nn.nspname AS schemaname,