Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8m8A-0002H1-K3 for pgsql-general@arkaria.postgresql.org; Wed, 18 Apr 2018 12:24:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f8m89-0008NT-BP for pgsql-general@arkaria.postgresql.org; Wed, 18 Apr 2018 12:24:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8m89-0008NI-3H for pgsql-general@lists.postgresql.org; Wed, 18 Apr 2018 12:24:09 +0000 Received: from mail.dbi-services.com ([195.70.1.167] helo=33229-ml-01.dfinet.ch) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8m85-0005ye-T9 for pgsql-general@postgresql.org; Wed, 18 Apr 2018 12:24:08 +0000 Received: from 33229-ml-01.dfinet.ch (localhost [127.0.0.1]) by 33229-ml-01.dfinet.ch (Postfix) with ESMTPS id CEB63C0720D9; Wed, 18 Apr 2018 14:24:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by 33229-ml-01.dfinet.ch (Postfix) with ESMTP id C0EE3C0720DC; Wed, 18 Apr 2018 14:24:03 +0200 (CEST) X-Virus-Scanned: amavisd-new at 33229-ml-01.dfinet.ch Received: from 33229-ml-01.dfinet.ch ([127.0.0.1]) by localhost (33229-ml-01.dfinet.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id fcLiqieCUnEX; Wed, 18 Apr 2018 14:24:03 +0200 (CEST) Received: from 33229-ml-01.dfinet.ch (33229-ml-01.dfinet.ch [10.128.30.2]) by 33229-ml-01.dfinet.ch (Postfix) with ESMTP id 99939C0720D9; Wed, 18 Apr 2018 14:24:03 +0200 (CEST) Date: Wed, 18 Apr 2018 14:24:02 +0200 (CEST) From: Daniel Westermann To: Pavan Deolasee Cc: Pgsql General list Message-ID: <1794030567.31110.1524054242271.JavaMail.zimbra@dbi-services.com> In-Reply-To: References: <1717499812.27146.1524053137683.JavaMail.zimbra@dbi-services.com> Subject: Re: pg_locks.relation question MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_27bbb55a-08d0-445a-92bc-70740d7ffdc6" X-Originating-IP: [92.104.112.131] X-Mailer: Zimbra 8.8.7_GA_1964 (ZimbraWebClient - FF59 (Linux)/8.8.7_GA_1964) Thread-Topic: pg_locks.relation question Thread-Index: 9HfzV+Vc2Qm54DiIvhGwsGPBJMG7aw== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_27bbb55a-08d0-445a-92bc-70740d7ffdc6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On Wed, Apr 18, 2018 at 5:35 PM, Daniel Westermann < [ mailto:daniel.westermann@dbi-services.com | daniel.westermann@dbi-services.com ] > wrote: Hi, session one: locks=# begin; BEGIN locks=# alter table test add column b text; ALTER TABLE locks=# Session 2 querying pg_locks for the PID from above: locks=# select locktype,relation::regclass,mode from pg_locks where pid = 2026 and locktype = 'relation'; locktype | relation | mode ----------+----------+--------------------- relation | test | AccessExclusiveLock relation | 17728 | AccessExclusiveLock relation | 17726 | ShareLock (3 rows) What are these 17728 and 17726 OIDs? Nothing else is happening except these two sessions. >>Those are probably the OIDs of the toast table and the index on it. If you commit the transaction running in Session 1 and then query >>pg_class for those OIDs, you might see more details. Of course, I am just guessing without looking into much detail. Thx, Pavan, that's it. --=_27bbb55a-08d0-445a-92bc-70740d7ffdc6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Wed, Apr 18, 2018 at 5:35 PM, Daniel Westermann &l= t;d= aniel.westermann@dbi-services.com> wrote:
<= div style=3D"font-family:arial,helvetica,sans-serif;font-size:12pt;color:#0= 00000">
Hi,

session one:

locks=3D# begin;
BE= GIN
locks=3D# alter table test add co= lumn b text;
ALTER TABLE
locks=3D#

Session 2 que= rying pg_locks for the PID from above:

locks=3D# select locktype,relation::regclass,mode from pg_locks w= here pid =3D 2026 and locktype =3D 'relation';
 locktype | relation |      &n= bsp; mode        
----------+----------+--------------------- relation | test     = | AccessExclusiveLock
 relation = | 17728    | AccessExclusiveLock
 relation | 17726    | ShareLock
<= span style=3D"font-family:"courier new",courier,monaco,monospace,= sans-serif;font-size:10pt">(3 rows)

What are these= 17728 and 17726 OIDs? Nothing else is happening except these two sessions.=


>>Those are probably = the OIDs of the toast table and the index on it. If you commit the transact= ion running in Session 1 and then query >>pg_class for those OIDs, yo= u might see more details. Of course, I am just guessing without looking int= o much detail. 

Thx, Pavan, that's it.




=
--=_27bbb55a-08d0-445a-92bc-70740d7ffdc6--