On 6 October 2017 at 13:24, <josef.machytka@gmail.com> wrote: > After that in first case postgresql crashed (which was more or less OK > because it restarted) but in second case the whole Debian instance crashed
What causes the crash, is it the out-of-memory (OOM) killer? How have you configured overcommit on your Debian instance?
If it is the OOM killer killing your process, you may want to disable overcommit. Doing that should cause the client to get a decent error message instead of the the whole cluster being restarted.