1

Im using PostgreSQL 13.3 on x86_64-pc-linux-gnu, and Im trying to find the root cause of :

ERROR:  out of shared memory
HINT:  You might need to increase max_pred_locks_per_transaction.

So I test by using BEGIN ISOLATION LEVEL SERIALIZABLE; then query with conditions, the problem is that even the number of SIReadLock is larger than max_pred_locks_per_transaction*max_connections, I still can query, there is no 'out of shared memory' at all:

smart=*# show max_pred_locks_per_transaction;
 max_pred_locks_per_transaction 
--------------------------------
 10
(1 row)

smart=*# show max_connections;
 max_connections 
-----------------
 3
(1 row)

smart=*# SELECT count(*) FROM pg_locks WHERE mode = 'SIReadLock';
 count 
-------
   250
(1 row)

So please help me to indicate that SIReadLock is limited by which configuration ? and, which configuration and lock relate to 'You might need to increase max_pred_locks_per_transaction' ?

Thank you.

1 Answer 1

0

If you look at the code, you will find that the maximum number of predicate locks is calculated as

max_pred_locks_per_transaction * (
    max_connections +
    autovacuum_max_workers +
    1 +
    max_worker_processes +
    max_wal_senders + max_prepared_xacts
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.