Re: SELECT blocks UPDATE

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: twoflower <standa(dot)kurik(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT blocks UPDATE
Date: 2015-08-13 21:20:02
Message-ID: 55CD0A02.3000202@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/13/2015 02:14 PM, twoflower wrote:
> Further observation: Now I managed to get rid of the blocking. I am not sure
> if you are familiar with the NHibernate ORM, but it has a concept of a
> stateful and stateless sessions. Session holds a connection to the database
> and transaction is created on a particular session. In this case, 'begin
> transaction' and the SELECT statement was executed in the context of the
> stateful session, while the UPDATE was executed on a stateless session. I am
> not sure how this situation manifests on Postgres but since the 'blocked'
> and 'blocking' lock apparently belong to the same transaction, it does not
> look like it should matter, except it does.

I would crank up the Postgres logging:

http://www.postgresql.org/docs/9.4/interactive/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT

At least set log_statement to all, to see what is actually being sent to
the server from the ORM during the above.

>
>
>
> --
> View this message in context: http://postgresql.nabble.com/SELECT-blocks-UPDATE-tp5862040p5862097.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-08-13 23:58:06 Re: SELECT blocks UPDATE
Previous Message twoflower 2015-08-13 21:14:44 Re: SELECT blocks UPDATE