How to debug when OS kills postgres for high memory usage I am running Postgres 9.4 server in a VPS running Ubuntu. It gets killed often (multiple times in a day).
This is the message from dmesg

Out of memory: Kill process 1020 (postgres) score 64 or sacrifice child
Killed process 1020 (postgres) total-vm:445764kB, anon-rss:140640kB, file-rss:136092kB

How to debug what is causing this crash? Is it long running queries or some misconfiguration of the server or lots of idle connections open?
It's the OOM killer in the Linux kernel. Disable VM overcommit, per the advice in the PostgreSQL manual.