From d21ae91c3e64ccd9d85f43d1c74389e451f3ac0f Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 22 Jun 2024 16:42:38 +0200 Subject: [PATCH] postgresql: tune --- modules/postgresql/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/postgresql/default.nix b/modules/postgresql/default.nix index 2980bb09..580701d2 100644 --- a/modules/postgresql/default.nix +++ b/modules/postgresql/default.nix @@ -3,7 +3,27 @@ { services.postgresql = { enable = true; + # Required for MediaWiki, connects via docker network enableTCPIP = true; + # https://pgtune.leopard.in.ua/ DB Version: 14 OS Type: linux DB Type: web + # Total Memory (RAM): 8 GB Data Storage: ssd + settings = { + max_connections = 200; + shared_buffers = "2GB"; + effective_cache_size = "6GB"; + maintenance_work_mem = "512MB"; + checkpoint_completion_target = 0.9; + wal_buffers = "16MB"; + default_statistics_target = 100; + random_page_cost = 1.1; + effective_io_concurrency = 200; + work_mem = "5242kB"; + huge_pages = "off"; + min_wal_size = "1GB"; + max_wal_size = "4GB"; + # ZFS is always consistent (Copy-On-Write) + full_page_writes = false; + }; }; systemd.services.postgresql = {