PG
PRO
53400ERRORTier 2 — Caution✅ HIGH confidence

configuration limit exceeded

Category: Insufficient ResourcesVersions: All Postgres versions

What this means

SQLSTATE 53400 is raised when a configured resource limit is exceeded — for example, exceeding the maximum number of locks, shared memory segments, or other configurable resource caps.

Why it happens

  1. 1Exceeding max_locks_per_transaction (the maximum number of locks one transaction can hold)
  2. 2Exceeding other configurable resource limits defined in postgresql.conf

How to reproduce

Transaction holding more locks than max_locks_per_transaction allows.

trigger — this will ERROR
-- A transaction that acquires locks on tens of thousands of objects:
BEGIN;
-- LOCK many tables...
ERROR: out of shared memory HINT: You might need to increase max_locks_per_transaction.

Fix 1: Increase max_locks_per_transaction in postgresql.conf

When a legitimate use case requires many locks.

fix
-- In postgresql.conf:
-- max_locks_per_transaction = 256 (default is 64)

Why this works

max_locks_per_transaction controls the shared lock table size. Increasing it requires a server restart.

Fix 2: Reduce the number of objects locked per transaction

When the lock count can be reduced by redesigning the operation.

fix

Why this works

Break large operations into smaller transactions that lock fewer objects at a time.

Sources

📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html

📚 Feature docs: https://www.postgresql.org/docs/current/runtime-config-locks.html

🔧 Source ref: Class 53 — Insufficient Resources

Confidence assessment

✅ HIGH confidence

Standard SQLSTATE for configuration limit exhaustion. Stable across versions.

See also

📄 Reference pages

max_locks_per_transactionLocksShared Memory
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →