Tom Lane escribió:
> Crash safety. The basic process in vacuum full is:
>
> * detect that there is room in a lower-numbered page to move the
> physically last tuple to.
>
> * put a copy of the last tuple there. Mark the last tuple itself
> as deleted by the VACUUM.
Hmm, I've seen people doing piecemeal table shrinking with no exclusive
locking by looking up the live tuples in the last page, doing no-op
UPDATEs until they moves those tuples to an earlier page with free
space, and then hoping that plain VACUUM will detect that this page is
empty and truncating it. I wonder if we could write some (semi-)
automatic way of doing this. The benefit is that the page ends up
truncated to a reasonable of pages, reducing bloat, without requiring
the table to be exclusive-locked.
The main problem with this approach is that it is fairly painful to deal
with CTID values. The operator support for them is pretty poor.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support