From: | Hemil Ruparel <hemilruparel2002(at)gmail(dot)com> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Are advisory locks guaranteed to be First Come First Serve? And can the behavior be relied upon? |
Date: | 2020-08-27 07:18:32 |
Message-ID: | CANW1aT-Eu58R4Cty=i=nV1Hy=of4VL+gY_q4FgFLBYwnmKtH4w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks a lot
On Thu 27 Aug, 2020, 12:23 PM Laurenz Albe, <laurenz(dot)albe(at)cybertec(dot)at>
wrote:
> On Thu, 2020-08-27 at 10:10 +0530, Hemil Ruparel wrote:
> > I was playing with Advisory locks. I opened three connections to the
> database And obtained
> > a lock with the same key. I noticed that the locks were obtained in the
> order of requests.
> > I was wondering whether the locks are guaranteed to be First Come First
> Serve and can this
> > behaviour be relied upon.
>
> Yes - lock requests that block are queued, with later lock requests queued
> behind previous
> ones. Once a lock gets free, the first in line gets it.
>
> This is the same for all heavyweight locks in PostgreSQL.
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Susan Joseph | 2020-08-27 10:57:19 | Re: SSL between Primary and Seconday PostgreSQL DBs |
Previous Message | Laurenz Albe | 2020-08-27 06:53:53 | Re: Are advisory locks guaranteed to be First Come First Serve? And can the behavior be relied upon? |