Re: Must be owner to truncate? - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Must be owner to truncate?
Date
Msg-id 20050709135752.GV24207@ns.snowman.net
Whole thread Raw
In response to Re: Must be owner to truncate?  (Mike Mascari <mascarm@mascari.com>)
Responses Re: Must be owner to truncate?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
* Mike Mascari (mascarm@mascari.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

pgsql-hackers by date:

Previous
From: Mike Mascari
Date:
Subject: Re: Must be owner to truncate?
Next
From: Tom Lane
Date:
Subject: Re: Must be owner to truncate?