Re: Locking concurrency: select for update vs update

From: Szymon Lipiński <mabewlun(at)gmail(dot)com>
To: Streamsoft - Mirek Szajowski <m(dot)szajowski(at)streamsoft(dot)pl>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Locking concurrency: select for update vs update
Date: 2016-06-07 07:35:05
Message-ID: CAFjNrYuZKbjXrKQ1PKRr0pykQAzcbsMnBpyRqaegzRYaVU1OtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 7 June 2016 at 09:31, Streamsoft - Mirek Szajowski <
m(dot)szajowski(at)streamsoft(dot)pl> wrote:

> Hello,
>
> I have two tables phone_number and phone_number_type
>
> When I start transaction and insert phone_number using FK from
> phone_number_type. Then I can during another TX update row from
> phone_number_type, but I can't execute select for update on it.
>
> In db stats I see during inserInto AccessShareLock, during update
> RowExclusieLock but during select for update AccessExclusieLock.
>
> Why I can't execute 'select for update' but I can update???? We often use
> 'select for update' to avoid update the same record in differents TX but I
> don't understand why this block another tx from using this record as FK
>
>
> Best regards
> Mirek
>
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

What do you mean by " can't execute select for update on it"? Can you show
an example code, and the error you get?

--
regards Szymon Lipiński

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Streamsoft - Mirek Szajowski 2016-06-07 07:38:31 Re: Locking concurrency: select for update vs update
Previous Message Streamsoft - Mirek Szajowski 2016-06-07 07:31:47 Locking concurrency: select for update vs update