Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> I'm sure this has been brought up before, does someone have a pointer to
> a discussion about doing VACUUM-like work in a sequential scan?
Yeah, it's been discussed before; try looking for "incremental vacuum"
and such phrases.
The main stumbling block is cleaning out index entries for the
known-dead heap tuple. The current VACUUM design amortizes that cost
across as many dead heap tuples as it can manage; doing it retail seems
inevitably to be a lot more expensive.
regards, tom lane