From: Michael Renner Date: Wed, 3 Apr 2013 10:40:39 +0000 (+0200) Subject: bloat query: fix totalwastedbytes X-Git-Tag: 2.20.1~18 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=189106fdb91121e2f7ba0f2b5dd1552cb0886a8c;p=check_postgres.git bloat query: fix totalwastedbytes totalwastedbytes returned only the number of wasted pages - fix that by multiplying with the blocksize --- 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