Re: [HACKERS] Re: vacuum timings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Re: vacuum timings
Date
Msg-id 9694.948492126@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: vacuum timings  (The Hermit Hacker <scrappy@hub.org>)
Responses Re: [HACKERS] Re: vacuum timings
List pgsql-hackers
The Hermit Hacker <scrappy@hub.org> writes:
>> lock table for less duration, or read lock

> if there is some way that we can work around the bug that I believe Tom
> found with removing the lock altogether (ie. makig use of MVCC), I think
> that would be the best option ... if not possible, at least get things
> down to a table lock vs the whole database?

Huh?  VACUUM only requires an exclusive lock on the table it is
currently vacuuming; there's no database-wide lock.

Even a single-table exclusive lock is bad, of course, if it's a large
table that's critical to a 24x7 application.  Bruce was talking about
the possibility of having VACUUM get just a write lock on the table;
other backends could still read it, but not write it, during the vacuum
process.  That'd be a considerable step forward for 24x7 applications,
I think.

It looks like that could be done if we rewrote the table as a new file
(instead of compacting-in-place), but there's a problem when it comes
time to rename the new files into place.  At that point you'd need to
get an exclusive lock to ensure all the readers are out of the table too
--- and upgrading from a plain lock to an exclusive lock is a well-known
recipe for deadlocks.  Not sure if this can be solved.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alfred Perlstein
Date:
Subject: Re: [HACKERS] pg_dump disaster
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] pg_dump disaster