out of shared memory 🐘 PostgreSQL

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

A transaction took more locks than the lock table can hold — usually touching many tables/partitions at once.

Seen on: PostgreSQL

Meaning

Each table/partition/index accessed takes a lock. Large partitioned tables, pg_dump of many tables, or dropping many objects in one transaction exhaust max_locks_per_transaction.

Common causes

  • Queries over many partitions
  • pg_dump/pg_restore of thousands of tables
  • Bulk DDL in one transaction

⚡ Quick fix

  1. Increase max_locks_per_transaction (restart required)
  2. Split work into smaller transactions
  3. Reduce partitions touched per query

Detailed fix by platform

PostgreSQL

  1. ALTER SYSTEM SET max_locks_per_transaction = 256; -- then restart

How to diagnose

  1. Scope — How many tables/partitions involved?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.