Re: Must be owner to truncate?
Stephen Frost <sfrost@snowman.net>
From: Stephen Frost <sfrost@snowman.net>
To: Mike Mascari <mascarm@mascari.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, andrew@supernews.com, pgsql-hackers@postgresql.org
Date: 2005-07-09T13:57:52Z
Lists: 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