Simon Riggs <simon@2ndQuadrant.com> writes:
> I think what I am suggesting is two heap passes, but writing WAL and
> dirtying blocks on only one of the passes.
I think you've all forgotten about hint-bit setting. The assumption is
that the first VACUUM pass is going to update a lot of hint bits and we
might as well get some other work done with the same write.
Now of course that doesn't necessarily entail a WAL write too, but
it makes this less than a slam-dunk win.
Also, I think that the reason the code ended up this way is that there
were pretty severe difficulties in making the VACUUM code cope correctly
with un-pruned tuples. Pavan might remember more about that.
regards, tom lane