Re: Avoiding deadlocks ...

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Avoiding deadlocks ...
Date: 2010-08-20 16:57:47
Message-ID: AANLkTinrER_07juUcO9FJraya_0dr_QfHx9e-Coa6wP3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 19, 2010 at 11:51 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> update session where id = X;
>                        update order where orderid = 5;
> update order where orderid = 5;

So i think this will already deadlock.

A has a exclusive-lock on session<X> and is waiting on order<5>. B has
an exclusive lock on order<5> and is waiting on a share-lock on
session<x>

>                        update order where orderid = 5;
> ... deadlock error.
>

Do you actually get a prompt here to type this command?

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2010-08-20 17:07:36 Re: Avoiding deadlocks ...
Previous Message Joshua D. Drake 2010-08-20 16:30:07 Re: git: uh-oh