Search Postgresql Archives

Re: VACUUM and transactions in different databases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In response to Alvaro Herrera <alvherre@xxxxxxxxxxxxxxxxx>:

> Bill Moran wrote:
> > In response to Christopher Browne <cbbrowne@xxxxxxx>:
> > > Oops! c@xxxxxxxxxxxxxxxxxxx (Cornelia Boenigk) was seen spray-painting on a wall:
> > > > Hi all
> > > >
> > > > If I have a running transaction in database1 and try to vacuum
> > > > database2 but the dead tuples in database2 cannot be removed.
> > > >
> > > > INFO:  vacuuming "public.dummy1"
> > > > INFO:  "dummy1": found 0 removable, 140000 nonremovable row versions
> > > > in 1341 pages
> > > > DETAIL:  135000 dead row versions cannot be removed yet.
> > > >
> > > > How can I achieve that database2 is vacuumed while a transaction in
> > > > database1 is not yet commited?
> > > 
> > > You can't, unless you're on 8.1, and the not-yet-committed transaction
> > > is VACUUM.
> > 
> > I'm a little confused.
> > 
> > First off, it would seem as if this is completely eliminated in 8.2, as
> > I tested a scenario involving an idle transaction in one database, and
> > both vacuum and vacuum full were able to complete in another database
> > without completing the first transaction.
> 
> Of course they are able to complete, but the point is that they would
> not remove the tuples that would be visible to that idle open
> transaction.

I would expect that, but the OP claimed that vacuum full waited until
the other transaction was finished.

> > Are you saying that in 8.1, there is a single exception to this, which
> > is that if db1 (for example) is in the process of running vacuum, it
> > won't block db2 from vacuuming?  But that any other type of transaction
> > can block operations in other databases?
> 
> In 8.2, a process running lazy vacuum (but not vacuum full) will not
> interfere with another process running vacuum, i.e., the second vacuum
> will be able to remove the tuples even if they would be seen by the
> transaction doing the first vacuum -- regardless of the database to
> which any of them is connected (i.e., it may be the same database or
> different databases).  I don't remember if this was in 8.1 or was
> introduced in 8.2.

So lazy vacuum never waits on transactions.  Apparently (based on the
OP) vacuum full _does_ wait on transactions in versions prior to 8.2,
but based on my experiment, in 8.2 vacuum full no longer does.

Of course, in any version, vacuum can't clean up tuples held by open
transactions.

At least, that's what it's looking like to me.

-- 
Bill Moran
Collaborative Fusion Inc.

wmoran@xxxxxxxxxxxxxxxxxxxxxxx
Phone: 412-422-3463x4023

****************************************************************
IMPORTANT: This message contains confidential information and is
intended only for the individual named. If the reader of this
message is not an intended recipient (or the individual
responsible for the delivery of this message to an intended
recipient), please be advised that any re-use, dissemination,
distribution or copying of this message is prohibited. Please
notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or
omissions in the contents of this message, which arise as a
result of e-mail transmission.
****************************************************************


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux