# PostgreSQL 15 ARM64 Production Configuration for Raspberry Pi 4 # Optimized for DataShield workloads #------------------------------------------------------------------------------ # CONNECTIONS AND AUTHENTICATION #------------------------------------------------------------------------------ listen_addresses = '*' port = 5432 max_connections = 200 superuser_reserved_connections = 3 #------------------------------------------------------------------------------ # RESOURCE USAGE (Raspberry Pi 4 Optimized) #------------------------------------------------------------------------------ # Memory Configuration for 4GB Raspberry Pi 4 shared_buffers = 512MB # 25% of RAM effective_cache_size = 2GB # 50% of RAM work_mem = 8MB # Per connection maintenance_work_mem = 128MB # For maintenance operations # ARM64 Specific Optimizations effective_io_concurrency = 200 # SSD optimization random_page_cost = 1.1 # SSD vs HDD # Checkpoint Configuration checkpoint_completion_target = 0.9 wal_buffers = 16MB min_wal_size = 512MB max_wal_size = 2GB # Background Writer bgwriter_delay = 10ms bgwriter_lru_maxpages = 200 bgwriter_lru_multiplier = 2.0 #------------------------------------------------------------------------------ # WRITE-AHEAD LOG (WAL) #------------------------------------------------------------------------------ wal_level = replica fsync = on synchronous_commit = on wal_sync_method = fdatasync full_page_writes = on wal_compression = on wal_log_hints = off #------------------------------------------------------------------------------ # REPLICATION #------------------------------------------------------------------------------ max_wal_senders = 3 max_replication_slots = 3 wal_keep_size = 256MB #------------------------------------------------------------------------------ # QUERY TUNING #------------------------------------------------------------------------------ default_statistics_target = 100 random_page_cost = 1.1 effective_io_concurrency = 200 parallel_tuple_cost = 0.1 parallel_setup_cost = 1000.0 min_parallel_table_scan_size = 8MB min_parallel_index_scan_size = 512kB # JIT Configuration (ARM64 optimized) jit = on jit_above_cost = 100000 jit_inline_above_cost = 500000 jit_optimize_above_cost = 500000 #------------------------------------------------------------------------------ # LOGGING #------------------------------------------------------------------------------ logging_collector = on log_destination = 'stderr' log_directory = 'log' log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' log_rotation_age = 1d log_rotation_size = 100MB log_min_messages = warning log_min_error_statement = error log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h ' log_checkpoints = on log_connections = on log_disconnections = on log_lock_waits = on log_temp_files = 10MB #------------------------------------------------------------------------------ # AUTOMATIC VACUUM #------------------------------------------------------------------------------ autovacuum = on log_autovacuum_min_duration = 0 autovacuum_max_workers = 3 autovacuum_naptime = 1min autovacuum_vacuum_threshold = 50 autovacuum_analyze_threshold = 50 autovacuum_vacuum_scale_factor = 0.2 autovacuum_analyze_scale_factor = 0.1 autovacuum_freeze_max_age = 200000000 autovacuum_multixact_freeze_max_age = 400000000 autovacuum_vacuum_cost_delay = 2ms autovacuum_vacuum_cost_limit = -1 #------------------------------------------------------------------------------ # CLIENT CONNECTION DEFAULTS #------------------------------------------------------------------------------ client_min_messages = warning search_path = '"$user", public' default_table_access_method = 'heap' default_tablespace = '' default_toast_compression = 'pglz' timezone = 'UTC' timezone_abbreviations = 'Default' extra_float_digits = 1 #------------------------------------------------------------------------------ # EXTENSIONS CONFIGURATION #------------------------------------------------------------------------------ # Enable required extensions for DataShield shared_preload_libraries = 'pg_stat_statements' # pg_stat_statements configuration pg_stat_statements.max = 10000 pg_stat_statements.track = all pg_stat_statements.track_utility = off pg_stat_statements.save = on #------------------------------------------------------------------------------ # SECURITY #------------------------------------------------------------------------------ ssl = off password_encryption = scram-sha-256