pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: hi+postgresql@yamlcoder.me
Subject: BUG #18053: fastpath count per pid in pg_locks shows > 16 entries
Date: Thu, 10 Aug 2023 12:31:04 +0000
Message-ID: <18053-c80f1cbe77bed71f@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18053
Logged by:          Maxim Ivanov
Email address:      hi+postgresql@yamlcoder.me
PostgreSQL version: 15.2
Operating system:   Linux
Description:        

my understanding that fastpath locking is limited to 16 locks, but when
querying live system there are pids with 17 or sometimes even 18 fastpath
locks:

```
 select pid, count(case when fastpath then 1 end) as num_fastpath_locks from
pg_locks where locktype = 'relation' group by pid having  count(case when
fastpath then 1 end) > 16;
  pid   | num_fastpath_locks 
--------+--------------------
 476053 |                 17
 490499 |                 17
 493405 |                 17
 495253 |                 17
 500332 |                 17
 500336 |                 17
 501218 |                 17
````


Here is a full list of locks for one of those pids:

```
 with locks as materialized (
select * from pg_locks
)  select * from locks join  (select pid, count(case when fastpath then 1
end) as num_fastpath_locks from locks where locktype = 'relation' group by
pid having  count(case when fastpath then 1 end) > 16 limit 1) v on
(locks.pid = v.pid);
   locktype    | database | relation  | page | tuple |  virtualxid  |
transactionid | classid | objid | objsubid | virtualtransaction |  pid   |  
    mode       | granted | fastpath | waitstart |  pid   |
num_fastpath_locks 
---------------+----------+-----------+------+-------+--------------+---------------+---------+-------+----------+--------------------+--------+------------------+---------+----------+-----------+--------+--------------------
 relation      | 31097292 |  31097661 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097646 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097631 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097616 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097601 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097586 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097571 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097556 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097541 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097526 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097511 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097496 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097481 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097466 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097451 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097436 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097436 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
RowExclusiveLock | t       | t        |           | 478235 |                
17
 virtualxid    |          |           |      |       | 256/12671598 |       
       |         |       |          | 256/12671598       | 478235 |
ExclusiveLock    | t       | t        |           | 478235 |                
17
 relation      | 31097292 |  31097871 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097721 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097706 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097676 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097841 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097556 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
RowExclusiveLock | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097691 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097736 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097766 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 transactionid |          |           |      |       |              |   
2587561133 |         |       |          | 256/12671598       | 478235 |
ExclusiveLock    | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097811 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097916 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097826 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097781 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097856 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097796 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097751 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097901 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 | 334256066 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
 relation      | 31097292 |  31097886 |      |       |              |       
       |         |       |          | 256/12671598       | 478235 |
AccessShareLock  | t       | f        |           | 478235 |                
17
```



Message-ID: <18053-c80f1cbe77bed71f@postgresql.org>
Permalink:  ../18053-c80f1cbe77bed71f@postgresql.org/
Also on:    postgresql.org/message-id/18053-c80f1cbe77bed71f@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, hi+postgresql@yamlcoder.me
  Subject: Re: BUG #18053: fastpath count per pid in pg_locks shows > 16 entries
  In-Reply-To: <18053-c80f1cbe77bed71f@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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