From 72e7626e9d31ac2407856f181d380886b1282157 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Tue, 23 Jan 2024 05:31:06 +0100 Subject: [PATCH] tsuki/postgres: tune for bare metal setup --- hosts/tsuki/services/postgres.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hosts/tsuki/services/postgres.nix b/hosts/tsuki/services/postgres.nix index 2f7c2cc..f481f87 100644 --- a/hosts/tsuki/services/postgres.nix +++ b/hosts/tsuki/services/postgres.nix @@ -11,7 +11,31 @@ in { host all all ::1/128 trust ''; settings = { + # Source: https://pgtune.leopard.in.ua/ + # DB Version: 15 + # OS Type: linux + # DB Type: mixed + # Total Memory (RAM): 12 GB + # CPUs num: 12 + # Connections num: 150 + # Data Storage: hdd + max_connections = 150; + shared_buffers = "3GB"; + effective_cache_size = "9GB"; + maintenance_work_mem = "768MB"; + checkpoint_completion_target = 0.9; + wal_buffers = "16MB"; + default_statistics_target = 100; + random_page_cost = 4; + effective_io_concurrency = 2; + work_mem = "2621kB"; + min_wal_size = "1GB"; + max_wal_size = "4GB"; + max_worker_processes = 12; + max_parallel_workers_per_gather = 4; + max_parallel_workers = 12; + max_parallel_maintenance_workers = 4; }; };