pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_locks.relation question
3+ messages / 2 participants
[nested] [flat]

* pg_locks.relation question
@ 2018-04-18 12:05  Daniel Westermann <daniel.westermann@dbi-services.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Daniel Westermann @ 2018-04-18 12:05 UTC (permalink / raw)
  To: pgsql-general

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. 

Thanks in advance 
Daniel 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_locks.relation question
@ 2018-04-18 12:16  Pavan Deolasee <pavan.deolasee@gmail.com>
  parent: Daniel Westermann <daniel.westermann@dbi-services.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Pavan Deolasee @ 2018-04-18 12:16 UTC (permalink / raw)
  To: Daniel Westermann <daniel.westermann@dbi-services.com>; +Cc: pgsql-general

On Wed, Apr 18, 2018 at 5:35 PM, Daniel Westermann <
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.

Thanks,
Pavan

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_locks.relation question
@ 2018-04-18 12:24  Daniel Westermann <daniel.westermann@dbi-services.com>
  parent: Pavan Deolasee <pavan.deolasee@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Daniel Westermann @ 2018-04-18 12:24 UTC (permalink / raw)
  To: Pavan Deolasee <pavan.deolasee@gmail.com>; +Cc: pgsql-general

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. 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-04-18 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 12:05 pg_locks.relation question Daniel Westermann <daniel.westermann@dbi-services.com>
2018-04-18 12:16 ` Pavan Deolasee <pavan.deolasee@gmail.com>
2018-04-18 12:24   ` Daniel Westermann <daniel.westermann@dbi-services.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox