Locking concurrency: select for update vs update - Mailing list pgsql-performance

From Streamsoft - Mirek Szajowski
Subject Locking concurrency: select for update vs update
Date
Msg-id 473f22e1-c89c-61cb-b70c-46b3cb172588@streamsoft.pl
Whole thread Raw
Responses Re: Locking concurrency: select for update vs update
Re: Locking concurrency: select for update vs update
List 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


pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: index fragmentation on insert-only table with non-unique column
Next
From: Szymon Lipiński
Date:
Subject: Re: Locking concurrency: select for update vs update