Re: understand the pg locks in in an simple case

2019-08-26 Thread Alex
On Tue, Aug 20, 2019 at 10:52 PM Alex wrote: > > > On Tue, Aug 20, 2019 at 4:59 PM Heikki Linnakangas > wrote: > >> On 20/08/2019 10:23, Alex wrote: >> > I have troubles to understand the pg lock in the following simple >> > situation. >> > >> > >> > Session 1: >> > >> > >> > begin; update

Re: understand the pg locks in in an simple case

2019-08-20 Thread Alex
On Tue, Aug 20, 2019 at 4:59 PM Heikki Linnakangas wrote: > On 20/08/2019 10:23, Alex wrote: > > I have troubles to understand the pg lock in the following simple > > situation. > > > > > > Session 1: > > > > > > begin; update tset a= 1 where a= 10; > > > > > > Session 2: > > > > > >

Re: understand the pg locks in in an simple case

2019-08-20 Thread Heikki Linnakangas
On 20/08/2019 10:23, Alex wrote: I have troubles to understand the pg lock in the following simple situation. Session 1: begin; update tset a= 1 where a= 10; Session 2: begin; update tset a= 2 where a= 10; They update the same row and session 2 is blocked by session 1

Re: understand the pg locks in in an simple case

2019-08-20 Thread Laurenz Albe
Alex wrote: > But when I check the pg_locks: session 1. I can see no tuple lock > there, when I check the session 2, I can see a > tuple(ExclusiveLock) is granted, but it is waiting for a > transactionid. > > since every tuple has txn information, so it is not hard to > implement it this

understand the pg locks in in an simple case

2019-08-20 Thread Alex
I have troubles to understand the pg lock in the following simple situation. Session 1: begin; update t set a = 1 where a = 10; Session 2: begin; update t set a = 2 where a = 10; They update the same row and session 2 is blocked by session 1 without surprise. The pretty straight