Search Postgresql Archives

Re: Tracking down a deadlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bill Moseley <moseley@xxxxxxxx> writes:
> Then when I run the test script (which runs the same transaction in two
> processes at the same time) and get a deadlock the same query is shown twice
> both with "waiting" set true:

>         UPDATE account set foo = 123 where id = $1

> And if I remove that update from the transaction I no longer have the deadlock.
> So, it seems like that is the problem update.

> Is postgresql telling me that it's deadlocked on two transactions trying to run
> that same update?

Looks like it.

> There are no other updates to that account table in the transaction, so I'm
> confused how that is causing a deadlock.

Is there more than one row with the target id?  Does the account table
have any foreign-key references to or from it?  It's sometimes possible
to get a deadlock associated with trying to lock FK-referenced rows that
several updated rows have in common.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux