|
1 | 1 | #------------------------------------------------------------------------------
|
2 | 2 | # CONNECTIONS AND AUTHENTICATION
|
3 | 3 | #------------------------------------------------------------------------------
|
4 |
| - |
5 |
| -listen_addresses = '*' # Allow connections from all addresses |
6 |
| -max_connections = 200 # Increase connections for a larger server |
7 |
| -superuser_reserved_connections = 5 # Reserve for superusers |
| 4 | +listen_addresses = '*' # Allow connections from any network interface |
| 5 | +max_connections = 200 # Increase if you expect more concurrent connections |
| 6 | +superuser_reserved_connections = 5 # Reserve connections for superusers |
8 | 7 |
|
9 | 8 | #------------------------------------------------------------------------------
|
10 | 9 | # RESOURCE USAGE
|
11 | 10 | #------------------------------------------------------------------------------
|
12 | 11 |
|
13 | 12 | # - Memory Configuration -
|
14 |
| -shared_buffers = 14GB # Allocate ~25% of total memory |
15 |
| -work_mem = 512MB # Increase per-query memory |
16 |
| -maintenance_work_mem = 4GB # Allow more memory for VACUUM/ALTER operations |
17 |
| -effective_cache_size = 41GB # 75% of total memory for caching |
| 13 | +shared_buffers = 14GB # ~25% of total 55GB; adjust if needed |
| 14 | +work_mem = 256MB # Memory for each sort/hash operation; be cautious with many parallel queries |
| 15 | +maintenance_work_mem = 4GB # Larger memory for VACUUM / CREATE INDEX / ALTER |
| 16 | +effective_cache_size = 36GB # ~60-70% of total memory to inform the planner |
18 | 17 |
|
19 |
| -# - Disk Optimization for SSD - |
20 |
| -random_page_cost = 1.0 # Optimize for SSD storage |
21 |
| -seq_page_cost = 1.0 # Default for sequential scans |
| 18 | +# - Disk Optimization for SSD (if using SSD) - |
| 19 | +random_page_cost = 1.0 # Lower cost for random I/O on SSD |
| 20 | +seq_page_cost = 1.0 # Default cost for sequential scans |
22 | 21 |
|
23 | 22 | #------------------------------------------------------------------------------
|
24 | 23 | # WRITE-AHEAD LOG (WAL)
|
25 | 24 | #------------------------------------------------------------------------------
|
26 |
| - |
27 |
| -wal_level = replica # Required for replication if needed |
28 |
| -checkpoint_timeout = 15min # Increase checkpoint frequency |
29 |
| -max_wal_size = 4GB # Allow more WAL before forcing a checkpoint |
30 |
| -min_wal_size = 1GB # Set a lower boundary for WAL size |
31 |
| -wal_compression = lz4 # Enable LZ4 compression for WAL files (default in PG 17) |
32 |
| -synchronous_commit = off # Improve performance by reducing commit overhead |
| 25 | +wal_level = replica # Required for replication; 'minimal' if no replication is used |
| 26 | +checkpoint_timeout = 15min # Interval between automatic WAL checkpoints |
| 27 | +max_wal_size = 4GB # Amount of WAL to accumulate before forcing a checkpoint |
| 28 | +min_wal_size = 1GB # Minimum size to keep WAL files |
| 29 | +wal_compression = lz4 # Compress WAL segments to reduce disk usage (PG17 default) |
| 30 | +synchronous_commit = off # Improves write performance, risk of data loss if crash |
33 | 31 |
|
34 | 32 | #------------------------------------------------------------------------------
|
35 | 33 | # AUTOVACUUM SETTINGS
|
36 | 34 | #------------------------------------------------------------------------------
|
37 |
| - |
38 |
| -autovacuum_max_workers = 6 # More workers due to higher CPU count |
39 |
| -autovacuum_naptime = 30s # Run autovacuum frequently |
40 |
| -autovacuum_vacuum_cost_limit = -1 # Allow PostgreSQL to auto-adjust vacuum cost |
| 35 | +autovacuum_max_workers = 6 # More parallel vacuum workers for busy systems |
| 36 | +autovacuum_naptime = 30s # How often the autovacuum daemon checks for work |
| 37 | +autovacuum_vacuum_cost_limit = -1 # Let PostgreSQL adjust vacuum cost dynamically |
41 | 38 |
|
42 | 39 | #------------------------------------------------------------------------------
|
43 | 40 | # QUERY TUNING
|
44 | 41 | #------------------------------------------------------------------------------
|
45 |
| - |
46 |
| -effective_io_concurrency = 300 # Optimize IO operations for SSDs |
47 |
| -parallel_tuple_cost = 0.1 # Encourage parallel execution |
48 |
| -parallel_setup_cost = 500 # Lower parallel setup cost |
49 |
| -max_worker_processes = 28 # Utilize all CPU cores |
50 |
| -max_parallel_workers_per_gather = 8 # Allow more parallel workers per query |
51 |
| -max_parallel_workers = 28 # Utilize all available parallel workers |
| 42 | +effective_io_concurrency = 300 # For SSD; helps the planner estimate IO concurrency |
| 43 | +parallel_tuple_cost = 0.1 # Lower cost to encourage parallelization |
| 44 | +parallel_setup_cost = 500 # Lower to encourage more parallel plans |
| 45 | +max_worker_processes = 28 # Allow up to 28 worker processes |
| 46 | +max_parallel_workers_per_gather = 8 # Max workers that can help a single query |
| 47 | +max_parallel_workers = 28 # Total number of parallel workers across all queries |
52 | 48 |
|
53 | 49 | #------------------------------------------------------------------------------
|
54 | 50 | # LOGGING
|
55 | 51 | #------------------------------------------------------------------------------
|
56 |
| - |
57 |
| -logging_collector = off # Disable logging to improve performance |
58 |
| -log_statement = 'none' # Disable all SQL statement logging |
59 |
| -log_min_duration_statement = -1 # Do not log slow queries |
60 |
| -log_duration = off # Disable duration logging |
61 |
| -log_error_verbosity = terse # Show minimal error messages |
62 |
| - |
63 |
| -; #------------------------------------------------------------------------------ |
64 |
| -; # CLIENT CONNECTION DEFAULTS |
65 |
| -; #------------------------------------------------------------------------------ |
66 |
| - |
67 |
| -; statement_timeout = 600000 # Terminate queries running longer than 10 min |
68 |
| -; lock_timeout = 600000 # Timeout for acquiring locks |
69 |
| -; idle_in_transaction_session_timeout = 600000 # Close idle transactions after 10 min |
| 52 | +logging_collector = off # Disable log collection |
| 53 | +log_statement = 'none' # Do not log any statements |
| 54 | +log_duration = off # Disable logging query duration |
| 55 | +log_min_duration_statement = -1 # Disable logging slow queries |
| 56 | +log_error_verbosity = terse # Minimal error messages |
| 57 | +log_autovacuum_min_duration = -1 # Do not log autovacuum runs |
| 58 | +log_connections = on # Do not log new connections |
| 59 | +log_disconnections = on # Do not log disconnections |
| 60 | +log_lock_waits = off # Do not log lock waits |
| 61 | +log_temp_files = -1 # Do not log temporary file creation |
| 62 | +log_checkpoints = off # Do not log checkpoints |
| 63 | +log_replication_commands = off # Do not log replication-related commands |
| 64 | +log_directory = '/dev/null' # Redirect logs to /dev/null (no storage) |
| 65 | +#------------------------------------------------------------------------------ |
| 66 | +# CLIENT CONNECTION DEFAULTS |
| 67 | +#------------------------------------------------------------------------------ |
| 68 | +statement_timeout = 600000 # Kill any query running longer than 10 minutes |
| 69 | +lock_timeout = 600000 # Timeout for acquiring locks |
| 70 | +idle_in_transaction_session_timeout = 600000 # Close transactions idle for more than 10 minutes |
70 | 71 |
|
71 | 72 | #------------------------------------------------------------------------------
|
72 | 73 | # LOCALE AND TIMING
|
73 | 74 | #------------------------------------------------------------------------------
|
74 |
| - |
75 | 75 | datestyle = 'iso, mdy'
|
76 | 76 | timezone = 'Etc/UTC'
|
77 | 77 | lc_messages = 'en_US.utf8'
|
|
0 commit comments