Re: Is there an equivalent to sp_getapplock, sp_releaseapplock in PostgreSql?

From: Justin <zzzzz(dot)graf(at)gmail(dot)com>
To: Andrei Zhidenkov <andrei(dot)zhidenkov(at)n26(dot)com>, "pgsql general (pgsql-general(at)postgresql(dot)org)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is there an equivalent to sp_getapplock, sp_releaseapplock in PostgreSql?
Date: 2019-12-13 14:41:46
Message-ID: CALL-XePNn4cfD_80aaXZg=Hb1zWo1VpcZCH3K+UdaD9gWcZQ5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Ityas

Advisory locks do not act like the locks in MSSQL, Postgresql will ignore
advisory locks for other transactions, its up the applications layer to
poll/ obey/ enforce advisory locks

You can do the type of locking as in MSSQL with Postgresql but its avoided
in practice as that is the point of MVCC, allow the database to handle
locking/updating of resources. Odds of Deadlocks go way down...

Postgresql has always run in the optional MSSQL Snap Shot Isolation Mode
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/snapshot-isolation-in-sql-server

I think MSSQL is now the only major database still shipped with MVCC turned
off..
https://www.postgresql.org/docs/current/mvcc-intro.html

On Fri, Dec 13, 2019 at 9:06 AM Andrei Zhidenkov <andrei(dot)zhidenkov(at)n26(dot)com>
wrote:

> I’m not sure what these function exactly do in MSSQL but what in Postgres
> you probably can use “Advisory Locks” (
> https://www.postgresql.org/docs/9.4/explicit-locking.html) in order to
> achive this.
>
> On 13. Dec 2019, at 13:31, İlyas Derse <ilyasderse(at)gmail(dot)com> wrote:
>
> sp_getapplock
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Abraham, Danny 2019-12-15 14:32:52 Is there any tool that provides Physical Backup plus PITR for a single database ( Not the whole PG instance ) ?
Previous Message Andrei Zhidenkov 2019-12-13 14:05:38 Re: Is there an equivalent to sp_getapplock, sp_releaseapplock in PostgreSql?