Re: deadlock in single-row select-for-update + update scenario? How could it happen?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: hubert depesz lubaczewski <depesz(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: deadlock in single-row select-for-update + update scenario? How could it happen?
Date: 2014-08-22 17:20:10
Message-ID: 53F77BCA.9040307@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/22/2014 10:15 AM, hubert depesz lubaczewski wrote:
> On Fri, Aug 22, 2014 at 6:45 PM, Adrian Klaver
> <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>
> So process 66017 and 66014 are blocking each because they are
> running the exact same queries. The interesting part is the process
> with the lower pid is starting later then the none with the higher pid.
>
>
> Locking is obvious. But why deadlock? There is just single row, and it
> shouldn't be able to deadlock on it?!

Well both queries are doing SELECT .. FOR UPDATE as well as UPDATE. From
what I see there are four queries contending for the same row.

>
> So what exactly is 'importer' and what does it do?
>
>
> Some software written by some guy. Runs lots of queries, but the only
> problem we have is with these transactions.
>
> Also what is this (59303)?
>
>
> log_line_prefix is '%m %r %p %u %d ' so it's port number.

So why are different processes running the exact same queries coming in
on different ports?

>
> depesz

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2014-08-22 17:29:14 Re: deadlock in single-row select-for-update + update scenario? How could it happen?
Previous Message hubert depesz lubaczewski 2014-08-22 17:15:41 Re: deadlock in single-row select-for-update + update scenario? How could it happen?