Re: pg_locks.relation question

From: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
To: Daniel Westermann <daniel(dot)westermann(at)dbi-services(dot)com>
Cc: Pgsql General list <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_locks.relation question
Date: 2018-04-18 12:16:07
Message-ID: CABOikdOVzD-Q-YYg6-rHk86r+Ck1MM3sPGyRMYvcJ7R6aFPOww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 18, 2018 at 5:35 PM, Daniel Westermann <
daniel(dot)westermann(at)dbi-services(dot)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.

Thanks,
Pavan

--
Pavan Deolasee http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Westermann 2018-04-18 12:24:02 Re: pg_locks.relation question
Previous Message Vitaliy Garnashevich 2018-04-18 12:15:50 Tricking the optimizer