Re: Doubt w.r.t vacuum - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Doubt w.r.t vacuum
Date
Msg-id 8797.1059399881@sss.pgh.pa.us
Whole thread Raw
In response to Doubt w.r.t vacuum  ("Shridhar Daithankar" <shridhar_daithankar@persistent.co.in>)
List pgsql-hackers
"Shridhar Daithankar" <shridhar_daithankar@persistent.co.in> writes:
> 1. IIRC vacuum recovers/reuses dead tuples generated from update but can not do 
> so for delete? Why?

This is not correct.

> 2. Vacuum full locks entire table, is it possible that it locks a page at a 
> time and deal with it.

No.  You can't compact the table by moving tuples without locking the
entire table.  (For example, if we move a tuple from the end down to an
earlier page, it's quite possible that a concurrently executing
sequential scan would miss that tuple entirely.  Another problem is that
we cannot truncate the table to fewer pages without locking out writers;
else we may decide that there are N empty pages, then execute ftruncate()
just after someone has put a new tuple into one of those pages.)

Non-full vacuum is designed specifically to do what can be done without
an exclusive lock.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Warning for undefined cursor
Next
From: Tom Lane
Date:
Subject: Re: Some macros for error field codes