From: | Streamsoft - Mirek Szajowski <m(dot)szajowski(at)streamsoft(dot)pl> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Locking concurrency: select for update vs update |
Date: | 2016-06-07 13:26:27 |
Message-ID: | 2af91a21-bdaf-f245-0b88-2046064ccce6@streamsoft.pl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Thanks
after your description I found select name from phone_number_type WHERE
id_phone_number_type=4 for *NO KEY* update (Postgresql 9.3 )
W dniu 2016-06-07 o 15:24, Tom Lane pisze:
> Streamsoft - Mirek Szajowski <m(dot)szajowski(at)streamsoft(dot)pl> writes:
>> Why I can't execute 'select for update' but I can update?
> In recent PG versions, the lock held due to having inserted an FK
> dependent row effectively only locks the key fields of the parent row.
> UPDATE can tell whether you're trying to change the row's key fields,
> and it will proceed if you aren't. SELECT FOR UPDATE has to lock the
> whole row (since it must assume you might be intending to change any
> fields of the row); so it blocks until the FK lock goes away.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Rafał Gutkowski | 2016-06-07 13:39:14 | Combination of partial and full indexes |
Previous Message | Tom Lane | 2016-06-07 13:24:10 | Re: Locking concurrency: select for update vs update |