>I think it's related to the problem of figuring out how many dead tuples
you expect to find in the overall heap, which you need to do to have >any
hope of this being a comprehensive estimate.

An  estimate of number of index scans while vacuuming can be done using
estimate of total dead tuples in the relation and maintenance work mem.
n_dead_tuples in pg_stat_all_tables can be used as an estimate of dead
tuples.

Following can be a way to estimate,

if nindexes == 0
  index_scans =0
else if pages_all_visible
  index_scans =0
else
  index_scans = Max((n_dead_tuples * space occupied by single dead
tuple)/m_w_m,1)

This estimates index_scans = 1 if n_dead_tuples = 0 assuming lazy scan heap
is likely to find some dead_tuples.
If n_dead_tuples is non zero the above estimate gives a lower bound on
number of index scans possible.


Thank you,
Rahila Syed

Reply via email to