Re: [PROPOSAL] VACUUM Progress Checker. - Mailing list pgsql-hackers

From Rahila Syed
Subject Re: [PROPOSAL] VACUUM Progress Checker.
Date
Msg-id CAH2L28tHrZLpGtwkofKUV8igpa6+mF60R-HBg2Gkh42tczg5JQ@mail.gmail.com
Whole thread Raw
In response to Re: [PROPOSAL] VACUUM Progress Checker.  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: [PROPOSAL] VACUUM Progress Checker.  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
>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 
  

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: LWLock deadlock and gdb advice
Next
From: Amit Kapila
Date:
Subject: Re: Reduce ProcArrayLock contention