summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorMichael Renner2013-04-03 10:40:39 +0000
committerMichael Renner2013-04-03 10:40:39 +0000
commit913fab7bf03746d7958b5c0630683c6a2965b5ea (patch)
tree6db8f11d8a0c3c08eea20067d2fd2e167e627e4c /check_postgres.pl
parentc01d94796fd936c604bebc489405ade1e95dad22 (diff)
bloat query: fix totalwastedbytes
totalwastedbytes returned only the number of wasted pages - fix that by multiplying with the blocksize
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index a3078f40d..246025e99 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -3531,9 +3531,9 @@ SELECT
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 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
+ CASE WHEN ipages < iotta THEN 0 ELSE bs*(ipages-iotta::bigint) END
+ ELSE CASE WHEN ipages < iotta THEN bs*(relpages-otta::bigint)
+ ELSE bs*(relpages-otta::bigint + ipages-iotta::bigint) END
END AS totalwastedbytes
FROM (
SELECT