|
| 1 | +#------------------------------------------------------------------------------ |
| 2 | +# PostgreSQL configuration optimized for IMPOSM imports/updates |
| 3 | +# Use this config when running imposm (heavy writes, large relations) |
| 4 | +# Switch back to postgresql.production.conf for normal Tegola serving |
| 5 | +#------------------------------------------------------------------------------ |
| 6 | + |
| 7 | +#------------------------------------------------------------------------------ |
| 8 | +# CONNECTIONS AND AUTHENTICATION |
| 9 | +#------------------------------------------------------------------------------ |
| 10 | +listen_addresses = '*' |
| 11 | +max_connections = 50 # Fewer connections, imposm only needs a few |
| 12 | +superuser_reserved_connections = 3 |
| 13 | + |
| 14 | +#------------------------------------------------------------------------------ |
| 15 | +# RESOURCE USAGE |
| 16 | +#------------------------------------------------------------------------------ |
| 17 | + |
| 18 | +# - Memory Configuration - |
| 19 | +shared_buffers = 14GB # ~25% of total 55GB |
| 20 | +work_mem = 512MB # More memory per operation for large geometries |
| 21 | +maintenance_work_mem = 8GB # Double for heavy index/vacuum operations during import |
| 22 | +effective_cache_size = 40GB # More cache since fewer connections compete |
| 23 | +temp_buffers = 256MB # More temp buffer space for large sorts |
| 24 | + |
| 25 | +# - Disk Optimization for SSD - |
| 26 | +random_page_cost = 1.0 |
| 27 | +seq_page_cost = 1.0 |
| 28 | + |
| 29 | +#------------------------------------------------------------------------------ |
| 30 | +# WRITE-AHEAD LOG (WAL) - Optimized for heavy writes |
| 31 | +#------------------------------------------------------------------------------ |
| 32 | +wal_level = minimal # Minimal WAL since no replication during import |
| 33 | +max_wal_senders = 0 # No replication slots needed |
| 34 | +checkpoint_timeout = 30min # Less frequent checkpoints during heavy writes |
| 35 | +max_wal_size = 16GB # Much larger WAL before forcing checkpoint |
| 36 | +min_wal_size = 2GB # Keep more WAL files ready |
| 37 | +wal_compression = lz4 |
| 38 | +synchronous_commit = off # Faster writes |
| 39 | +wal_buffers = 256MB # Larger WAL buffer for write-heavy workload |
| 40 | +full_page_writes = off # Faster writes (safe if using filesystem snapshots or ok with re-import) |
| 41 | + |
| 42 | +#------------------------------------------------------------------------------ |
| 43 | +# AUTOVACUUM - Reduced during import |
| 44 | +#------------------------------------------------------------------------------ |
| 45 | +autovacuum = on |
| 46 | +autovacuum_max_workers = 3 # Fewer workers, less competition with imposm |
| 47 | +autovacuum_naptime = 120s # Check less frequently during import |
| 48 | +autovacuum_vacuum_cost_limit = 1000 # Less aggressive vacuum |
| 49 | + |
| 50 | +#------------------------------------------------------------------------------ |
| 51 | +# QUERY TUNING |
| 52 | +#------------------------------------------------------------------------------ |
| 53 | +effective_io_concurrency = 300 |
| 54 | +parallel_tuple_cost = 0.001 |
| 55 | +parallel_setup_cost = 100 |
| 56 | +max_worker_processes = 28 |
| 57 | +max_parallel_workers_per_gather = 4 # Fewer parallel workers per query, more for writes |
| 58 | +max_parallel_workers = 28 |
| 59 | +max_parallel_maintenance_workers = 8 # More workers for CREATE INDEX after import |
| 60 | + |
| 61 | +#------------------------------------------------------------------------------ |
| 62 | +# LOGGING - Enable minimal logging to track slow imports |
| 63 | +#------------------------------------------------------------------------------ |
| 64 | +logging_collector = off |
| 65 | +log_statement = 'none' |
| 66 | +log_duration = off |
| 67 | +log_min_duration_statement = 300000 # Log queries taking more than 5 minutes |
| 68 | +log_error_verbosity = default # More detail for debugging import issues |
| 69 | +log_autovacuum_min_duration = -1 |
| 70 | +log_connections = off |
| 71 | +log_disconnections = off |
| 72 | +log_lock_waits = on # Log lock waits to detect contention |
| 73 | +log_temp_files = 0 # Log all temp file usage (sign of memory pressure) |
| 74 | +log_checkpoints = on # Log checkpoints to monitor write pressure |
| 75 | +log_replication_commands = off |
| 76 | +log_directory = '/dev/null' |
| 77 | + |
| 78 | +#------------------------------------------------------------------------------ |
| 79 | +# CLIENT CONNECTION DEFAULTS - No timeouts for large imports |
| 80 | +#------------------------------------------------------------------------------ |
| 81 | +statement_timeout = 0 # NO timeout - large relations can take very long |
| 82 | +lock_timeout = 3600000 # 1 hour lock timeout |
| 83 | +idle_in_transaction_session_timeout = 3600000 # 1 hour idle timeout |
| 84 | + |
| 85 | +#------------------------------------------------------------------------------ |
| 86 | +# LOCALE AND TIMING |
| 87 | +#------------------------------------------------------------------------------ |
| 88 | +datestyle = 'iso, mdy' |
| 89 | +timezone = 'Etc/UTC' |
| 90 | +lc_messages = 'en_US.utf8' |
| 91 | +lc_monetary = 'en_US.utf8' |
| 92 | +lc_numeric = 'en_US.utf8' |
| 93 | +lc_time = 'en_US.utf8' |
| 94 | + |
| 95 | +default_text_search_config = 'pg_catalog.english' |
0 commit comments