1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-30 11:37:44 +00:00

feat: move postgres to shared modules

This commit is contained in:
RGBCube 2025-02-27 23:40:34 +03:00
parent cb7ba948d9
commit dd4fa3b28d
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
7 changed files with 197 additions and 115 deletions

66
hosts/best/postgresql.nix Normal file
View file

@ -0,0 +1,66 @@
{ self, ... }: {
imports = [(self + /modules/postgresql.nix)];
# Generated by <https://pgconfigurator.cybertec.at/>
services.postgresql.settings = {
# Connectivity
max_connections = 100;
superuser_reserved_connections = 3;
# Memory Settings
shared_buffers = "10240 MB";
work_mem = "64 MB";
maintenance_work_mem = "620 MB";
huge_pages = "try"; # TODO: Tune kernel: <https://www.postgresql.org/docs/current/static/kernel-resources.html#LINUX-HUGE-PAGES>
effective_cache_size = "45 GB";
effective_io_concurrency = 100;
random_page_cost = 1.25;
# Monitoring
shared_preload_libraries = "pg_stat_statements";
track_io_timing = "on";
track_functions = "pl";
# Replication
wal_level = "replica";
max_wal_senders = 10;
synchronous_commit = "on";
# Checkpointing:
checkpoint_timeout = "15 min";
checkpoint_completion_target = 0.9;
max_wal_size = "1024 MB";
min_wal_size = "512 MB";
# WAL writing
wal_compression = "on";
wal_buffers = -1;
wal_writer_delay = "200ms";
wal_writer_flush_after = "1MB";
wal_keep_size = "3650 MB";
# Background writer
bgwriter_delay = "200ms";
bgwriter_lru_maxpages = 100;
bgwriter_lru_multiplier = 2.0;
bgwriter_flush_after = 0;
# Parallel queries:
max_worker_processes = 20;
max_parallel_workers_per_gather = 10;
max_parallel_maintenance_workers = 10;
max_parallel_workers = 20;
parallel_leader_participation = "on";
# Advanced features
enable_partitionwise_join = "on";
enable_partitionwise_aggregate = "on";
jit = "on";
max_slot_wal_keep_size = "1000 MB";
track_wal_io_timing = "on";
maintenance_io_concurrency = 100;
wal_recycle = "on";
};
}