Re: SELECT and RowExclusiveLock

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tim Nelson <timnels(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT and RowExclusiveLock
Date: 2017-04-07 20:40:56
Message-ID: CAKFQuwbHo=GYUm30+uAVRDBW+MsiEk9LyBV=2BKR-CybG=2ZvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Apr 7, 2017 at 1:25 PM, Tim Nelson <timnels(at)gmail(dot)com> wrote:

> New to Postgres and I have never seen this condition. We are getting test
> applications hanging on SELECT statements with a RowExclusiveLock. How can
> a SELECT cause a RowExclusiveLock?
>

Two common ways:

SELECT ... FOR UPDATE;

SELECT function_that_performs_updates();

There are some more moving parts here, especially transactions, that may be
coming into play. Its hard to say more given the limited and partial
detail. Version and a more complete pg_stat_activity query would be
helpful.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Iliffe 2017-04-07 21:38:22 Unable to connect to Postgresql
Previous Message Adrian Klaver 2017-04-07 20:40:01 Re: SELECT and RowExclusiveLock