Skip to content

Commit

Permalink
Merge pull request #468 from cybertec-postgresql/464_fix_get_table_bl…
Browse files Browse the repository at this point in the history
…oat_approx_sql

[-] fix `get_table_bloat_approx_sql()` when `tblpages = 0`, closes #464
  • Loading branch information
kmoppel-cognite committed Apr 25, 2022
2 parents afa52e4 + 7dbbf35 commit 02a4694
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Binaries for programs and plugins
pgwatch2
*.exe
*.exe~
*.dll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ FROM (
bs * tblpages AS real_size,
(tblpages - est_tblpages) * bs AS extra_size,
CASE
WHEN tblpages - est_tblpages > 0
WHEN tblpages > 0 AND tblpages - est_tblpages > 0
THEN 100 * (tblpages - est_tblpages) / tblpages::float
ELSE 0
END AS extra_ratio,
Expand All @@ -39,7 +39,7 @@ FROM (
ELSE 0
END AS bloat_size,
CASE
WHEN tblpages - est_tblpages_ff > 0
WHEN tblpages > 0 AND tblpages - est_tblpages_ff > 0
THEN 100 * (tblpages - est_tblpages_ff) / tblpages::float
ELSE 0
END AS bloat_ratio,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FROM (
bs * tblpages AS real_size,
(tblpages - est_tblpages) * bs AS extra_size,
CASE
WHEN tblpages - est_tblpages > 0
WHEN tblpages > 0 AND tblpages - est_tblpages > 0
THEN 100 * (tblpages - est_tblpages) / tblpages::float
ELSE 0
END AS extra_ratio,
Expand All @@ -40,7 +40,7 @@ FROM (
ELSE 0
END AS bloat_size,
CASE
WHEN tblpages - est_tblpages_ff > 0
WHEN tblpages > 0 AND tblpages - est_tblpages_ff > 0
THEN 100 * (tblpages - est_tblpages_ff) / tblpages::float
ELSE 0
END AS bloat_ratio,
Expand Down

0 comments on commit 02a4694

Please sign in to comment.