pg_stat_tmp should be on tmpfs

Summary

On a lightly loaded GitLab instance, the 'postgres: stats collector' process causes ~80% of write IO according to iotop. The postgres docs recommends storing the pg_stat_tmp directory on RAM filesystem: https://www.postgresql.org/docs/12/monitoring-stats.html#MONITORING-STATS-SETUP

Steps to reproduce

On a idle GitLab instance, open iotop, sort by 'disk write' and switch to accumulated counters ('a'). Wait a few minutes.

Total DISK READ:         0.00 B/s | Total DISK WRITE:       328.44 K/s
Current DISK READ:       0.00 B/s | Current DISK WRITE:     324.75 K/s
  TID  PRIO  USER     DISK READ DISK WRITE>  SWAPIN      IO    COMMAND                                                                   
 1243 be/4 gitlab-p      0.00 B     15.79 M  0.00 %  0.00 % postgres: stats collector
  228 be/3 root          0.00 B      2.18 M  0.00 %  0.06 % [jbd2/vda1-8]
 1195 be/4 gitlab-p      0.00 B   1576.00 K  0.00 %  0.00 % prometheus --web.listen-address=localh~r/opt/gitlab/prometheus/prometheus.yml
 1191 be/4 gitlab-p      0.00 B   1532.00 K  0.00 %  0.00 % prometheus --web.listen-address=localh~r/opt/gitlab/prometheus/prometheus.yml
 1165 be/4 gitlab-p      0.00 B   1104.00 K  0.00 %  0.00 % prometheus --web.listen-address=localh~r/opt/gitlab/prometheus/prometheus.yml
 1232 be/4 gitlab-p      0.00 B   1064.00 K  0.00 %  0.00 % prometheus --web.listen-address=localh~r/opt/gitlab/prometheus/prometheus.yml
 1166 be/4 gitlab-p      0.00 B    808.00 K  0.00 %  0.00 % prometheus --web.listen-address=localh~r/opt/gitlab/prometheus/prometheus.yml
 1122 be/4 root          0.00 B    432.00 K  0.00 %  0.00 % svlogd /var/log/gitlab/gitlab-workhorse

What is the current bug behavior?

GitLab unnecessarily writes to disk.

What is the expected correct behavior?

The https://www.postgresql.org/docs/12/runtime-config-statistics.html#GUC-STATS-TEMP-DIRECTORY should point to a directory on a tmpfs.

Details of package version

Provide the package version installation details
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-===========================================================
ii  gitlab-ce      13.3.5-ce.0  amd64        GitLab Community Edition (including NGINX, Postgres, Redis)
un  gitlab-ee                    (no description available)

Environment details

  • Operating System: Debian 10.5 (buster)
  • Installation Target, remove incorrect values:
    • VM: Other self-hosted qemu/libvirt on Ryzen
  • Installation Type, remove incorrect values:
    • Upgrade from version 7.10.3~omnibus-1 (kept up to date since then)
  • Is there any other software running on the machine: not in this VM
  • Is this a single or multiple node installation? single
  • Resources
    • CPU: 4 Core VM on AMD Ryzen 7 3700X
    • Memory total: 4GB in VM, 64GB total

Configuration details

Provide the relevant sections of `/etc/gitlab/gitlab.rb`
# there is no configuration option for `stats_temp_directory`