Re: getting deadlocks on full table lock

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: getting deadlocks on full table lock
Date: 2006-03-27 21:17:29
Message-ID: b42b73150603271317l486137a2yf003921e96e86e7a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/27/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Merlin Moncure" <mmoncure(at)gmail(dot)com> writes:
> > I am getting a deadlock which I can't explain...although maybe
> > somebody else can...here's the situation:
>
> TRUNCATE requires exclusive lock, and won't release it until end of
> transaction. Since you've already read something from the target
> table before attempting TRUNCATE, you already have AccessShareLock
> and are attempting to acquire AccessExclusiveLock. Classic deadly
> embrace.

duh. Anyways, I moved the update() above read part and this
eliminated most of the deadlocks...but I still got a few. Throwing a
'lock table mat_table' before truncate killed them all though.

Merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Feller 2006-03-27 21:23:28 Re: [Bulk] General advice on database/web applications
Previous Message beer 2006-03-27 21:03:15 Issues with restoring