Re: Is the "ACCESS EXCLUSIVE" lock for TRUNCATE really - Mailing list pgsql-general

From Florian G. Pflug
Subject Re: Is the "ACCESS EXCLUSIVE" lock for TRUNCATE really
Date
Msg-id 440D874F.1010104@phlo.org
Whole thread Raw
In response to Re: Is the "ACCESS EXCLUSIVE" lock for TRUNCATE really necessary?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> "Florian G. Pflug" <fgp@phlo.org> writes:
>>Tom Lane wrote:
>>
>>>Until when?  How would you synchronize the switchover?
>
>>Every snapshot would either contain the old, or the new version of
>>the corresponding pg_class tuple. The ones using the old version
>>couldn't possible be writer, only reader (TRUNCATE would still need
>>to acquire a lock that ensures that). New transactions started after
>>the commit of the truncate would see the new version, and use
>>the new datafile.
>
> Wrong.  *All* transactions read the system catalogs with SnapshotNow.
Ah, well that clearly kills my idea... Too bad...

I was fooled by the fact that most ddl-statements can be rolled back,
and assumed that this follows from using "normal" mvcc semantics when
reading the catalog tables.

Thanks for your explanations!

greetings, Florian Pflug

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_dump error - filesystem full
Next
From: Andrei
Date:
Subject: real - integer type cast in prepared statements