Re: update functions locking tables - Mailing list pgsql-general

From Michael Fuhr
Subject Re: update functions locking tables
Date
Msg-id 20050830125341.GA56245@winnie.fuhr.org
Whole thread Raw
In response to Re: update functions locking tables  (Clodoaldo Pinto <clodoaldo.pinto@gmail.com>)
Responses Re: update functions locking tables  (Clodoaldo Pinto <clodoaldo.pinto@gmail.com>)
List pgsql-general
On Tue, Aug 30, 2005 at 08:39:52AM -0300, Clodoaldo Pinto wrote:
>
> begin;
> select update_last_date();
> truncate times_producao;

TRUNCATE acquires an AccessExclusiveLock, which conflicts with all
other lock types.  Locks are held until the transaction completes,
so once this lock is acquired no other transactions will be able
to access the table until this transaction commits or rolls back.

DELETE is slower than TRUNCATE but it won't block readers in other
transactions.

--
Michael Fuhr

pgsql-general by date:

Previous
From: tomtailor@freesurf.fr
Date:
Subject: Re: Resore PG-Data from Files after crash
Next
From: "Reid Thompson"
Date:
Subject: Re: Select gives the wrong results