Wednesday, April 26, 2017

PostgreSQL: out of shared memory

Sometimes, some transactions are big enough to break the limit of max_locks_per_transaction, and this will cause "out of shared memory" errors.

Identify processes with their number of locks:
select distinct pid, count(*) over (partition by pid) as count from pg_locks
Then identify the query:
select * from pg_stat_activity where pid = 119254