mirror of
https://github.com/RGBCube/ncc
synced 2025-07-27 10:07:44 +00:00
feat: upgrade postgres database to 17
This commit is contained in:
parent
da34aaa065
commit
cb7ba948d9
1 changed files with 22 additions and 15 deletions
|
@ -27,15 +27,18 @@ in {
|
|||
];
|
||||
|
||||
config.services.postgresql = enabled {
|
||||
package = pkgs.postgresql_14;
|
||||
package = pkgs.postgresql_17;
|
||||
|
||||
enableJIT = true;
|
||||
|
||||
initdbArgs = [ "--locale=C" "--encoding=UTF8" ];
|
||||
|
||||
authentication = mkOverride 10 /* ini */ ''
|
||||
# Type Database DBUser Authentication
|
||||
# DATABASE USER AUTHENTICATION
|
||||
local all all peer
|
||||
|
||||
# DATABASE USER ADDRESS AUTHENTICATION
|
||||
host all all ::/0 md5
|
||||
'';
|
||||
|
||||
ensure = [ "postgres" "root" ];
|
||||
|
@ -54,10 +57,12 @@ in {
|
|||
});
|
||||
|
||||
settings = {
|
||||
listen_addresses = mkForce "";
|
||||
listen_addresses = mkForce "::";
|
||||
|
||||
# Generated by <https://pgconfigurator.cybertec.at/>
|
||||
max_connections = 100;
|
||||
|
||||
# Connectivity
|
||||
max_connections = 20;
|
||||
superuser_reserved_connections = 3;
|
||||
|
||||
# Memory Settings
|
||||
|
@ -66,20 +71,20 @@ in {
|
|||
maintenance_work_mem = "320 MB";
|
||||
huge_pages = "off";
|
||||
effective_cache_size = "3 GB";
|
||||
effective_io_concurrency = 1; # Concurrent IO only really activated if OS supports posix_fadvise function.
|
||||
random_page_cost = 4; # Speed of random disk access relative to sequential access (1.0).
|
||||
effective_io_concurrency = 1;
|
||||
random_page_cost = 4;
|
||||
|
||||
# Monitoring
|
||||
shared_preload_libraries = "pg_stat_statements"; # Per statement resource usage stats.
|
||||
track_io_timing = "on"; # Measure exact block IO times.
|
||||
track_functions = "pl"; # Track execution times of pl-language procedures if any.
|
||||
shared_preload_libraries = "pg_stat_statements";
|
||||
track_io_timing = "on";
|
||||
track_functions = "pl";
|
||||
|
||||
# Replication
|
||||
wal_level = "replica";
|
||||
max_wal_senders = 0;
|
||||
synchronous_commit = "on";
|
||||
|
||||
# Checkpointing
|
||||
# Checkpointing:
|
||||
checkpoint_timeout = "15 min";
|
||||
checkpoint_completion_target = 0.9;
|
||||
max_wal_size = "1024 MB";
|
||||
|
@ -87,7 +92,7 @@ in {
|
|||
|
||||
# WAL writing
|
||||
wal_compression = "on";
|
||||
wal_buffers = -1; # auto-tuned by Postgres till maximum of segment size (16MB by default).
|
||||
wal_buffers = -1;
|
||||
wal_writer_delay = "200ms";
|
||||
wal_writer_flush_after = "1MB";
|
||||
|
||||
|
@ -97,7 +102,7 @@ in {
|
|||
bgwriter_lru_multiplier = 2.0;
|
||||
bgwriter_flush_after = 0;
|
||||
|
||||
# Parallel queries
|
||||
# Parallel queries:
|
||||
max_worker_processes = 2;
|
||||
max_parallel_workers_per_gather = 1;
|
||||
max_parallel_maintenance_workers = 1;
|
||||
|
@ -105,11 +110,13 @@ in {
|
|||
parallel_leader_participation = "on";
|
||||
|
||||
# Advanced features
|
||||
enable_partitionwise_join = "on";
|
||||
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 = 1;
|
||||
wal_recycle = "on";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue