On Sat, Sep 19, 2026 at 7:55 PM Etsuro Fujita <[email protected]> wrote: > > 2. Consider whether do_analyze_rel should do something (like clear the > > pg_statistic rows for the relation) in the case where numrows returned from > > the acquirefunc is zero. > > I also thought this option; it would make things logically clean, but > I'm not sure we really need to do so, because in that case we set > reltuples=0 in pg_class, which makes the planner effectively ignore > the remaining attribute stats. See set_baserel_size_estimates(); if > reltuples=0, we have rel->tuples=0, so whatever value > clauselist_selectivity() calculates/returns based on the attribute > stats, rel->rows (the estimated number of output tuples from the base > relation) is set to zero.
Correction: since clamp_row_est() forces a row-count estimate to be at least one row, we have rel->rows=1, not rel->rows=0. Sorry. Best regards, Etsuro Fujita
