Re: Suggestion; "WITH VACUUM" option

From: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "" <josh(at)agliodbs(dot)com>, "" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Suggestion; "WITH VACUUM" option
Date: 2002-12-16 23:43:35
Message-ID: 20021216194018.J15947-100000@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 16 Dec 2002, scott.marlowe wrote:

> On Mon, 16 Dec 2002, Tom Lane wrote:
>
> > Josh Berkus <josh(at)agliodbs(dot)com> writes:
> > > How hard would it be to add a "WITH (VACUUM)" option to UPDATE and DELETE
> > > queries? This option would cause the regular vacuum activity -- purging the
> > > dead tuple and its index references -- to be done immediately, as part of the
> > > statement, instead of being deferred.
> >
> > > Easy? Hard? Insane? What do you think?
> >
> > Impossible. You can't vacuum a tuple until the last open transaction
> > that can see it is gone. It is therefore *impossible* for a transaction
> > to vacuum away its own detritus; until the transaction commits, you
> > can't even start to wonder whether other open transactions see it or
> > not.
> >
> > Vacuuming has to be done later, and that being the case, I don't see any
> > real advantage to altering the "background vacuum" design we have.
>
> Then, would a "commit with vacuum" work? OR a "begin transaction with
> vacuum" Just tossing them out there...

Tom will correct me here, but I believe what he was trying to get across
isn't that the 'current transaction' is the problem ... the problem is the
other connections who have open transactions ... my simplistic
understanding (and I hope it isn't too flawed) of MVCC is that as long as
*one* transaction is outstanding on a tuple, that tuple can't be
physically removed ... as far as any new transactions are concerned, it
has disappeared ... so if I open a transaction, then you open one 'with
vacuum', your 'with vacuum' will fail unless I happen to be out of my
transaction before you ...

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-12-16 23:45:30 Re: Creating a zero-column table
Previous Message Tom Lane 2002-12-16 23:07:05 Re: FW: Duplicate oids!