Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSs2N-00GSS9-Hq for pgsql-general@arkaria.postgresql.org; Thu, 25 Jan 2024 05:12:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rSs2M-00CLyD-Nw for pgsql-general@arkaria.postgresql.org; Thu, 25 Jan 2024 05:12:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSs2M-00CLy5-DM for pgsql-general@lists.postgresql.org; Thu, 25 Jan 2024 05:12:26 +0000 Received: from smtp103.ord1d.emailsrvr.com ([184.106.54.103]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSs2J-003FGK-N3 for pgsql-general@lists.postgresql.org; Thu, 25 Jan 2024 05:12:25 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp5.relay.ord1d.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 4C8D6A0081; Thu, 25 Jan 2024 00:12:22 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: Clarification regarding managing advisory locks in postgresql From: Christophe Pettus In-Reply-To: Date: Wed, 24 Jan 2024 21:11:20 -0800 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <31041CF7-85FC-4869-8F57-052B14D0044C@thebuild.com> References: To: Sasmit Utkarsh X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Classification-ID: 8ad99703-8aaf-4bb6-b1a9-c329dc1e2ede-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jan 24, 2024, at 19:17, Sasmit Utkarsh = wrote: >=20 > Need your support on understanding advisory locks in Postgresql and = what is the best practice to have advisory locks and unlocks to work = properly when we have multiple process forked from single process? Advisory locks are a shared resource across all of the database in which = they were created, and PostgreSQL isn't aware of the process model that = the client is using. If a session creates the advisory lock, that same = session will need to be the one to release it, and it's up to the client = program to keep track of which process is using which session.=