summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Renner2013-04-03 10:40:39 +0000
committerGreg Sabino Mullane2013-05-01 01:05:04 +0000
commit189106fdb91121e2f7ba0f2b5dd1552cb0886a8c (patch)
treec1fa69b84a02d6ca9f35b541c0e13df0fd52e6dd
parent890fc365bb621693993b1c0dab31d62b660e30c3 (diff)
bloat query: fix totalwastedbytes
totalwastedbytes returned only the number of wasted pages - fix that by multiplying with the blocksize
-rwxr-xr-xcheck_postgres.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index d11dc5d76..6482aa407 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