Re: pg_try_advisory_lock is waiting?

2022-01-28 Thread Michael Lewis
On Fri, Jan 28, 2022 at 5:34 PM Mladen Gogala wrote: > pg_try_advisory_lock returned TRUE even without "FOR UPDATE" clause in the > subquery. Shouldn't it return false because it can't lock the row until the > uncommitted update finishes? > > > > The rows

Re: pg_try_advisory_lock is waiting?

2022-01-28 Thread Mladen Gogala
On 1/28/22 19:08, Tom Lane wrote: I doubt it. I think the FOR UPDATE in the sub-select is blocked because the other session has an uncommitted update on the row it wants to lock. This command won't reach the pg_try_advisory_lock call until that row lock comes free. Yes, I figured it out, but

Re: pg_try_advisory_lock is waiting?

2022-01-28 Thread Tom Lane
Mladen Gogala writes: > I tried the following: > _*1st Session:*_ > mgogala=# begin transaction; > BEGIN > mgogala=*# update emp set sal=sal*1 where empno=7934; > UPDATE 1 > mgogala=*# > _*2nd Session:*_ > mgogala=# begin transaction; > BEGIN > mgogala=*# select pg_try_advisory_lock(0) from

Re: pg_try_advisory_lock is waiting?

2022-01-28 Thread Michael Lewis
pg_try_advisory_lock and other advisory lock functions take a lock on a key. The keys you have tried to lock are 0 and 1. Why? What problem are you trying to solve by changing from "for update" lock to advisory lock anyway?

pg_try_advisory_lock is waiting?

2022-01-28 Thread Mladen Gogala
I am trying to replace SELECT FROM WHERE FOR UPDATE with pg_try_advisory_lock. The documentation says the following: https://www.postgresql.org/docs/13/functions-admin.html |pg_try_advisory_lock| ( /|key|/ |bigint| ) → |boolean| |pg_try_advisory_lock| ( /|key1|/ |integer|, /|key2|/

Will Barman support restore of single database?

2022-01-28 Thread Andreas Joseph Krogh
Hi, pgBackRest supports restoring only specified database: https://pgbackrest.org/command.html#command-restore 11.1.3 Include Database Option (--db-include) Restore only specified databases. This feature allows only selected databases

Re: PostgreSQL Management and monitoring tool

2022-01-28 Thread Umair Shahid
On Thu, Jan 27, 2022 at 8:24 AM Lucas wrote: > > On 27/01/2022, at 3:00 PM, Bruce Momjian wrote: > > On Thu, Jan 27, 2022 at 02:28:17PM +1300, Lucas wrote: > > Hi guys. > > I’m migrating a few databases to PG 14 and was wondering that it would be > very > nice to have a tool to help me monitor