Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YLUrF-0004lp-WD for pgsql-sql@arkaria.postgresql.org; Wed, 11 Feb 2015 10:49:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YLUrF-0005ZP-GV for pgsql-sql@arkaria.postgresql.org; Wed, 11 Feb 2015 10:49:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YLUrE-0005ZI-Gm for pgsql-sql@postgresql.org; Wed, 11 Feb 2015 10:49:24 +0000 Received: from tkt-001-i374.relay.mailchannels.net ([174.136.5.177] helo=relay.mailchannels.net) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YLUr5-0004Nd-Bj for pgsql-sql@postgresql.org; Wed, 11 Feb 2015 10:49:23 +0000 X-Sender-Id: hostpapa|x-authuser|tompaynter@tdpe.co.uk Received: from hp139.hostpapa.com (ip-10-33-12-218.us-west-2.compute.internal [10.33.12.218]) by relay.mailchannels.net (Postfix) with ESMTPA id A7F0A1D058A for ; Wed, 11 Feb 2015 10:49:08 +0000 (UTC) X-Sender-Id: hostpapa|x-authuser|tompaynter@tdpe.co.uk Received: from hp139.hostpapa.com (hp139.hostpapa.com [10.224.7.213]) (using TLSv1 with cipher DHE-RSA-AES256-SHA) by 0.0.0.0:2500 (trex/5.4.3); Wed, 11 Feb 2015 10:49:10 GMT X-MC-Relay: Neutral X-MailChannels-SenderId: hostpapa|x-authuser|tompaynter@tdpe.co.uk X-MailChannels-Auth-Id: hostpapa X-MC-Loop-Signature: 1423651749874:1617444576 X-MC-Ingress-Time: 1423651749874 Received: from localhost ([127.0.0.1]:57481 helo=webmail.tdpe.co.uk) by hp139.hostpapa.com with esmtpa (Exim 4.84) (envelope-from ) id 1YLUqx-003dHf-2s for pgsql-sql@postgresql.org; Wed, 11 Feb 2015 10:49:10 +0000 Received: from 213.218.193.226 ([213.218.193.226]) (proxying for 213.218.193.226) (SquirrelMail authenticated user tompaynter@tdpe.co.uk) by webmail.tdpe.co.uk with HTTP; Wed, 11 Feb 2015 10:49:07 -0000 Message-ID: In-Reply-To: <20150211104038.5402756.43145.2247@gmail.com> References: <20150211104038.5402756.43145.2247@gmail.com> Date: Wed, 11 Feb 2015 10:49:07 -0000 Subject: Re: Advisory locks From: "Tom Paynter" To: pgsql-sql@postgresql.org User-Agent: SquirrelMail/1.5.2 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-OutGoing-Spam-Status: No, score=-2.9 X-AuthUser: tompaynter@tdpe.co.uk Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Thank you S=E1ndor, Just out of interest, is the following done just to make sure a row exists: SELECT pg_advisory_lock(table_a_id) FROM table_a WHERE table_a_id=3D5; As opposed to: SELECT pg_advisory_lock(5); Cheers, Tom On Wed, February 11, 2015 10:40 am, daku.sandor@gmail.com wrote: > The parameter of the pg_advisory_lock is a simple bigint and of course it > is completely unaware of the source of the value. > > Regards, > S=E1ndor Daku > > > =A0 Original Message =A0 > From: Tom Paynter > Sent: 2015. febru=E1r 11., szerda 11:33 > To: pgsql-sql@postgresql.org > Subject: [SQL] Advisory locks > > > Hello All, > > > I have a quick question about advisory locks, that I have not been able > to figure out from the documentation. > > > Say I have two tables: > CREATE TABLE table_a > ( > table_a_id serial primary key, some more rows.... ); > > > CREATE TABLE table_b > ( > table_b_id serial primary key, some more rows.... ); > > > > And I execute the following lines (from separate sessions): > SELECT pg_advisory_lock(table_a_id) FROM table_a WHERE table_a_id=3D5; > SELECT pg_advisory_lock(table_b_id) FROM table_b WHERE table_b_id=3D5; > > > > Will this try to acquire the same lock? > Or is the id tied to the table somehow? > > > > Thanks for your time. > Tom > > > > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > > --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql