You might get below error "division by zero" when using gp_bloat_diag_appendoptimized
ERROR: division by zero (seg94 slice3 10.130.221.41:40010 pid=88187)
This is a too generic error message and it needs to be replaced by a specific and relevant contextual error message for you to action.
GP 6.29.1 and earlier.
GP 7.5 and earlier.
The root cause of the `ERROR: division by zero` is because `gp_toolkit.gp_bloat_expected_pages_appendoptimized` does not have protection against eof==0 below:
(SELECT rel,
SUM(eof_uncompressed)/SUM(eof) AS ao_compress_ratio
FROM gp_toolkit.__gp_seg_all_summary()
Reproduction:
postgres=# create table test(a int) using ao_row;
CREATE TABLE
postgres=# insert into test values(2);
INSERT 0 1
postgres=# delete from test;
DELETE 1
postgres=# vacuum test;
VACUUM
postgres=# select * from gp_toolkit.gp_bloat_diag_appendoptimized;
ERROR: division by zero (seg2 slice1 127.0.0.1:7004 pid=33398)
No specific action required from you. The code fix shipped to 6x and 7x latest releases as of this article publishing.