deadlock detected, only selects (not select-for-update)

From: Gábor Farkas <gabor(at)nekomancer(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: deadlock detected, only selects (not select-for-update)
Date: 2007-10-24 07:44:38
Message-ID: 471EF7E6.6020403@nekomancer.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

i got the following error-message:

ERROR: deadlock detected
DETAIL: Process 32618 waits for ShareLock on transaction 1137032034;
blocked by process 16136.
Process 16136 waits for ShareLock on transaction 1137045910;
blocked by process 32618.

(postgres 7.4 here)

i checked the mailing-list-archives, and by such problems people always
have inserts/updates or at least select-for-updates.

the strange thing is, that the code that apparently produces this error
message does not have any of these.. it's mostly like:

(please note, that i cannot reproduce this problem, and also, i am not
logging all the sql commands. so i cannot be 100% sure that it was
caused by the following code, but from other tests, these are the
commands that are executed when the error happens)

BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
now a lot of selects, but nothing complicated, all of the form of
"SELECT x FROM y WHERE a=b", with some simple joins, and SELECT DISTINCT
and ORDER BY.
END;

can any of these commands cause the mentioned deadlock?

(of course, there are other processes that write to the database at this
time, but the one that reported the deadlock was this one)

as i said, i cannot reproduce it, so it's still possible, that when the
error happened, for some strange reason, also some other sql-commands
were executed, but i do not think so.

thanks,
gabor

Responses

Browse pgsql-general by date

  From Date Subject
Next Message cluster 2007-10-24 08:35:14 Selecting K random rows - efficiently!
Previous Message Pavel Stehule 2007-10-24 07:23:32 Re: (Never?) Kill Postmaster?