I think the only way to produce usable estimates is to report more than one number. And in the particular case of lazy vacuuming, ISTM the way to do it is to consider heap scanning as one phase, index cleanup as another phase; these two phases can be interleaved. And there's a final heap scan which is a third phase, which can only run after phases one and two are complete.
So you would report either "we're in phases one/two" or "we're in phase three". If we're in phases one/two, then we need to report 1. what's the page number of heap scan (i.e. how much more do we have to go yet?) 2. how many index scans have we done so far 3. if phase two, how many index pages have we scanned (total, i.e. across all indexes). The total number of heap pages is known, and the total number of index pages is also known, so it's possible to derive a percentage out of this part. Maybe it would be useful to report how much time it's been in phases one and two respectively; with that, I think it is possible to extrapolate the total time. If we're in third phase, we report the heap page number we're in. This looks pretty complicated to understand from the user POV, but anything other than this seems to me too simplistic to be of any use. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers