Re: Must be owner to truncate?

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, andrew(at)supernews(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Must be owner to truncate?
Date: 2005-07-09 13:57:52
Message-ID: 20050709135752.GV24207@ns.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Mike Mascari (mascarm(at)mascari(dot)com) wrote:
> Stephen Frost wrote:
>
> >delete from x;/truncate x;
> > --> Creates a new, empty, file and makes it the 'current' file
> > --> Marks the old file for deletion, but it is kept around for any
> > transactions which were started before the truncate;
> > --> New transactions use the empty file
> > --> Once all transactions using the old file have completed, the old
> > file can be deleted.
> > --> Old transactions which insert rows would need to use the new file
> > or scan the old file for rows which they added, I suppose.
>
> And when the transaction that issued the TRUNCATE aborts after step 3,
> but newer transactions commit?

The newer transactions would have to check for that situation. It's not
completely thought through, but at the same time I don't necessairly
think it's something that would be completely impossible to do and still
retain most of the performance benefits, at least in the most common
case.

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-07-09 15:48:35 Re: Must be owner to truncate?
Previous Message Mike Mascari 2005-07-09 13:47:50 Re: Must be owner to truncate?