Locking concurrency: select for update vs update

From: Streamsoft - Mirek Szajowski <m(dot)szajowski(at)streamsoft(dot)pl>
To: pgsql-performance(at)postgresql(dot)org
Subject: Locking concurrency: select for update vs update
Date: 2016-06-07 07:31:47
Message-ID: 473f22e1-c89c-61cb-b70c-46b3cb172588@streamsoft.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Szymon Lipiński 2016-06-07 07:35:05 Re: Locking concurrency: select for update vs update
Previous Message Jeff Janes 2016-06-05 19:28:47 Re: index fragmentation on insert-only table with non-unique column