Investigate compiling PG with "--with-systemd"
We hit issues where PG would restart itself for no apparent reason, 2 times already. One time on staging and another time on dev.gitlab.org https://gitlab.com/gitlab-com/infrastructure/issues/2474 .
Culprit is systemd with PG user: https://wiki.postgresql.org/wiki/Systemd
At the top of this wiki there is a recommendation that says
With PostgreSQL 9.6 or newer, it is recommended to build with --with-systemd and use the unit file shown in the documentation.
We should look into compiling with this flag but only after we check what they mean with using unit file.