Postgresql service stops while deleting/syncing big files

Hi,

I have Nextcloud 11.0.2(upgraded) on Ubuntu 14.04 with postgresql 9.3 as database. When big files (a few GB) are deleted/synced postgresql service stops making nextcloud unusable, and i have to restart postgresql to make it work again.

I found this in postgresql logs:
2017-05-17 14:17:51 BST LOG: checkpoints are occurring too frequently (4 seconds apart)
2017-05-17 14:17:51 BST HINT: Consider increasing the configuration parameter “checkpoint_segments”.
2017-05-17 14:34:03 BST LOG: server process (PID 15345) was terminated by signal 9: Killed
2017-05-17 14:16:58 BST DETAIL: Failed process was running:
SELECT “fileid”, “storage”, “path”, “parent”, “name”,
“mimetype”, “mimepart”, “size”, “mtime”, “encrypted”,
“etag”, “permissions”, "checksum"
FROM "oc_filecache"
WHERE “storage” = $1 AND “name” ILIKE $2
2017-05-17 14:16:58 BST LOG: terminating any other active server processes
2017-05-17 14:16:58 BST WARNING: terminating connection because of crash of another server process
2017-05-17 14:16:58 BST DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.

And this in nextcloud logs:
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘SELECT “fileid”, “storage”, “path”, “parent”, “name”, “mimetype”, “mimepart”, “size”, “mtime”, “storage_mtime”, “encrypted”, “etag”, “permissions”, “checksum” FROM “oc_filecache” WHERE “storage” = ? AND “path_hash” = ?’ with params [3, “ef3f1a3236b24e9273c72702901b3cc7”]: SQLSTATE[HY000]: General error: 7 server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

Any idea what exactly could make postgresql stop and how i could fix this?