Re: deadlock detected - when multiple threads try to update

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Harakiri <harakiri_23(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: deadlock detected - when multiple threads try to update
Date: 2005-12-03 16:01:15
Message-ID: 20051203075953.Q19848@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2 Dec 2005, Harakiri wrote:

> Hi, thanks for the response ,
>
> >
> > It's hard to say with just the above. Are you doing
> > other things in the
> > transactions besides a single update of that table
> > and/or is the order of
>
> in each transaction i do basically the same stuff :
>
> insert 1 row into table A, B, C (B and C have a
> foreign key in A) without any sub queries - i just
> plainy insert data..
>
> then - update my table D row for today with some
> numbers (as described)
>
> > events consistent between the transactions? Does the
> > table have any
> > triggers, rules or foreign keys?
>
> The table D in question does not have any triggers,
> rules or foreign keys - it has only one PK and a few
> numeric fields.
>
> I dont understand why, when multiple connections do :
>
> T1
> update myTable set field1 = field1 + 1, field2 =
> field2 + 5000 where myID = 1;
>
> T2
> update myTable set field1 = field1 + 1, field2 =
> field2 + 2500 where myID = 1;

I don't immediately see a reason either if it's deadlocking on the myTable
changes. Can you build a self-contained example with schema?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-12-03 16:43:00 Re: Reduce NUMERIC size by 2 bytes, reduce max length to 508 digits
Previous Message Thomas Pundt 2005-12-03 15:52:34 Re: Regular Expression Question