Search Postgresql Archives

Question about tuple´s lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!


I need some help to understand why a transaction wiht a row delete aquire a AccessExclusiveLock and a row update a ExclusiveLock.


To ilustrate, a made this scenario:

create table tblock

(

  id int primary key,

  value text

);

insert into tblock values (1, 'somevalue');


First start Transaction 1:

begin;

update tblock set value = 'othervalue' where id = 1;

-- keep this transaction opened


After, start Transaction 2:

begin;

update tblock set value = 'onemorevalue' where id = 1;

-- at this point, this transaction assumes a ExclusiveLock in the tuple;

-- keep this transaction opend


Then, start Transaction 3:

begin;

update tblock set value = 'lastofthevalues' where id = 1;

-- here i can see this transaction trying to aquire a AccessExclusiveLock in this tuple


So, my question is: why a delete row requires a AccessExclusiveLock in the tuple insteead of ExclusiveLock?


Bellow, a image of a query over pg_locks:


PostgreSQL version: 13

OS: Centos 7


Thanks in advance.

--
Carlos Alves
Especialista

Logo
Tecnisys

Sia Trecho 08, lotes 245 / 255 / 265 || +55 (61) 3039-9700
71205-080 || Guará || Brasília, DF 0800-6020097

www.tecnisys.com.br

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux