· 8 years ago · May 09, 2018, 09:08 AM
1# -----------------------------
2# PostgreSQL configuration file
3# -----------------------------
4#
5# This file consists of lines of the form:
6#
7# name = value
8#
9# (The "=" is optional.) Whitespace may be used. Comments are introduced with
10# "#" anywhere on a line. The complete list of parameter names and allowed
11# values can be found in the PostgreSQL documentation.
12#
13# The commented-out settings shown in this file represent the default values.
14# Re-commenting a setting is NOT sufficient to revert it to the default value;
15# you need to reload the server.
16#
17# This file is read on server startup and when the server receives a SIGHUP
18# signal. If you edit the file on a running system, you have to SIGHUP the
19# server for the changes to take effect, or use "pg_ctl reload". Some
20# parameters, which are marked below, require a server shutdown and restart to
21# take effect.
22#
23# Any parameter can also be given as a command-line option to the server, e.g.,
24# "postgres -c log_connections=on". Some parameters can be changed at run time
25# with the "SET" SQL command.
26#
27# Memory units: kB = kilobytes Time units: ms = milliseconds
28# MB = megabytes s = seconds
29# GB = gigabytes min = minutes
30# TB = terabytes h = hours
31# d = days
32
33
34#------------------------------------------------------------------------------
35# FILE LOCATIONS
36#------------------------------------------------------------------------------
37
38# The default values of these variables are driven from the -D command-line
39# option or PGDATA environment variable, represented here as ConfigDir.
40
41data_directory = '/var/lib/postgresql/9.5/main' # use data in another directory
42 # (change requires restart)
43hba_file = '/etc/postgresql/9.5/main/pg_hba.conf' # host-based authentication file
44 # (change requires restart)
45ident_file = '/etc/postgresql/9.5/main/pg_ident.conf' # ident configuration file
46 # (change requires restart)
47
48# If external_pid_file is not explicitly set, no extra PID file is written.
49external_pid_file = '/var/run/postgresql/9.5-main.pid' # write an extra PID file
50 # (change requires restart)
51
52
53#------------------------------------------------------------------------------
54# CONNECTIONS AND AUTHENTICATION
55#------------------------------------------------------------------------------
56
57# - Connection Settings -
58
59listen_addresses = '*' # what IP address(es) to listen on;
60 # comma-separated list of addresses;
61 # defaults to 'localhost'; use '*' for all
62 # (change requires restart)
63port = 5432 # (change requires restart)
64max_connections = 1500 # (change requires restart)
65# Note: Increasing max_connections costs ~400 bytes of shared memory per
66# connection slot, plus lock space (see max_locks_per_transaction).
67superuser_reserved_connections = 5 # (change requires restart)
68unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
69 # (change requires restart)
70#unix_socket_group = '' # (change requires restart)
71#unix_socket_permissions = 0777 # begin with 0 to use octal notation
72 # (change requires restart)
73#bonjour = off # advertise server via Bonjour
74 # (change requires restart)
75#bonjour_name = '' # defaults to the computer name
76 # (change requires restart)
77
78# - Security and Authentication -
79
80#authentication_timeout = 1min # 1s-600s
81ssl = true # (change requires restart)
82#ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers
83 # (change requires restart)
84#ssl_prefer_server_ciphers = on # (change requires restart)
85#ssl_ecdh_curve = 'prime256v1' # (change requires restart)
86ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
87ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
88#ssl_ca_file = '' # (change requires restart)
89#ssl_crl_file = '' # (change requires restart)
90#password_encryption = on
91#db_user_namespace = off
92#row_security = on
93
94# GSSAPI using Kerberos
95#krb_server_keyfile = ''
96#krb_caseins_users = off
97
98# - TCP Keepalives -
99# see "man 7 tcp" for details
100
101#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
102 # 0 selects the system default
103#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
104 # 0 selects the system default
105#tcp_keepalives_count = 0 # TCP_KEEPCNT;
106 # 0 selects the system default
107
108
109#------------------------------------------------------------------------------
110# RESOURCE USAGE (except WAL)
111#------------------------------------------------------------------------------
112
113# - Memory -
114
115shared_buffers = 8GB # min 128kB
116 # (change requires restart)
117#huge_pages = try # on, off, or try
118 # (change requires restart)
119temp_buffers = 80MB # min 800kB
120#max_prepared_transactions = 0 # zero disables the feature
121 # (change requires restart)
122# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
123# per transaction slot, plus lock space (see max_locks_per_transaction).
124# It is not advisable to set max_prepared_transactions nonzero unless you
125# actively intend to use prepared transactions.
126work_mem = 2GB # min 64kB
127maintenance_work_mem = 4GB # min 1MB
128#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
129#max_stack_depth = 2MB # min 100kB
130dynamic_shared_memory_type = posix # the default is the first option
131 # supported by the operating system:
132 # posix
133 # sysv
134 # windows
135 # mmap
136 # use none to disable dynamic shared memory
137
138# - Disk -
139
140#temp_file_limit = -1 # limits per-session temp file space
141 # in kB, or -1 for no limit
142
143# - Kernel Resource Usage -
144
145#max_files_per_process = 1000 # min 25
146 # (change requires restart)
147shared_preload_libraries = 'pg_stat_statements' # (change requires restart)
148pg_stat_statements.max = 100
149pg_stat_statements.track = all
150
151# - Cost-Based Vacuum Delay -
152
153#vacuum_cost_delay = 0 # 0-100 milliseconds
154#vacuum_cost_page_hit = 1 # 0-10000 credits
155#vacuum_cost_page_miss = 10 # 0-10000 credits
156#vacuum_cost_page_dirty = 20 # 0-10000 credits
157#vacuum_cost_limit = 200 # 1-10000 credits
158
159# - Background Writer -
160
161#bgwriter_delay = 200ms # 10-10000ms between rounds
162#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
163#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
164
165# - Asynchronous Behavior -
166
167effective_io_concurrency = 200 # 1-1000; 0 disables prefetching
168max_worker_processes = 8
169
170
171#------------------------------------------------------------------------------
172# WRITE AHEAD LOG
173#------------------------------------------------------------------------------
174
175# - Settings -
176
177wal_level = hot_standby # minimal, archive, hot_standby, or logical
178 # (change requires restart)
179#fsync = on # turns forced synchronization on or off
180synchronous_commit = off # synchronization level;
181 # off, local, remote_write, or on
182#wal_sync_method = fsync # the default is the first option
183 # supported by the operating system:
184 # open_datasync
185 # fdatasync (default on Linux)
186 # fsync
187 # fsync_writethrough
188 # open_sync
189#full_page_writes = on # recover from partial page writes
190#wal_compression = off # enable compression of full-page writes
191#wal_log_hints = off # also do full page writes of non-critical updates
192 # (change requires restart)
193wal_buffers = 16MB # min 32kB, -1 sets based on shared_buffers
194 # (change requires restart)
195#wal_writer_delay = 200ms # 1-10000 milliseconds
196
197#commit_delay = 0 # range 0-100000, in microseconds
198#commit_siblings = 5 # range 1-1000
199
200# - Checkpoints -
201
202#checkpoint_timeout = 5min # range 30s-1h
203max_wal_size = 8GB
204min_wal_size = 4GB
205checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0
206#checkpoint_warning = 30s # 0 disables
207
208# - Archiving -
209
210archive_mode = on # enables archiving; off, on, or always
211 # (change requires restart)
212archive_command = 'test ! -f /mnt/storage/disk1/pg_log_archive/%f && cp %p /mnt/storage/disk1/pg_log_archive/%f'
213 # command to use to archive a logfile segment
214 # placeholders: %p = path of file to archive
215 # %f = file name only
216 # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
217#archive_timeout = 0 # force a logfile segment switch after this
218 # number of seconds; 0 disables
219
220
221#------------------------------------------------------------------------------
222# REPLICATION
223#------------------------------------------------------------------------------
224
225# - Sending Server(s) -
226
227# Set these on the master and on any standby that will send replication data.
228
229#checkpoint_segments = 8
230max_wal_senders = 10 # max number of walsender processes
231 # (change requires restart)
232wal_keep_segments = 50 # in logfile segments, 16MB each; 0 disables
233#wal_sender_timeout = 60s # in milliseconds; 0 disables
234
235max_replication_slots = 10 # max number of replication slots
236 # (change requires restart)
237#track_commit_timestamp = off # collect timestamp of transaction commit
238 # (change requires restart)
239
240# - Master Server -
241
242# These settings are ignored on a standby server.
243
244#synchronous_standby_names = '' # standby servers that provide sync rep
245 # comma-separated list of application_name
246 # from standby(s); '*' = all
247#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
248
249# - Standby Servers -
250
251# These settings are ignored on a master server.
252
253hot_standby = on # "on" allows queries during recovery
254 # (change requires restart)
255#max_standby_archive_delay = 30s # max delay before canceling queries
256 # when reading WAL from archive;
257 # -1 allows indefinite delay
258#max_standby_streaming_delay = 30s # max delay before canceling queries
259 # when reading streaming WAL;
260 # -1 allows indefinite delay
261#wal_receiver_status_interval = 10s # send replies at least this often
262 # 0 disables
263hot_standby_feedback = on # send info from standby to prevent
264 # query conflicts
265#wal_receiver_timeout = 60s # time that receiver waits for
266 # communication from master
267 # in milliseconds; 0 disables
268#wal_retrieve_retry_interval = 5s # time to wait before retrying to
269 # retrieve WAL after a failed attempt
270
271
272#------------------------------------------------------------------------------
273# QUERY TUNING
274#------------------------------------------------------------------------------
275
276# - Planner Method Configuration -
277
278#enable_bitmapscan = on
279#enable_hashagg = on
280#enable_hashjoin = on
281#enable_indexscan = on
282#enable_indexonlyscan = on
283#enable_material = on
284#enable_mergejoin = on
285#enable_nestloop = on
286#enable_seqscan = on
287#enable_sort = on
288#enable_tidscan = on
289
290# - Planner Cost Constants -
291
292seq_page_cost = 1.1 # measured on an arbitrary scale
293random_page_cost = 1.1 # same scale as above
294#cpu_tuple_cost = 0.01 # same scale as above
295#cpu_index_tuple_cost = 0.005 # same scale as above
296#cpu_operator_cost = 0.0025 # same scale as above
297effective_cache_size = 24GB
298
299# - Genetic Query Optimizer -
300
301#geqo = on
302#geqo_threshold = 12
303#geqo_effort = 5 # range 1-10
304#geqo_pool_size = 0 # selects default based on effort
305#geqo_generations = 0 # selects default based on effort
306#geqo_selection_bias = 2.0 # range 1.5-2.0
307#geqo_seed = 0.0 # range 0.0-1.0
308
309# - Other Planner Options -
310
311default_statistics_target = 500 # range 1-10000
312#constraint_exclusion = partition # on, off, or partition
313#cursor_tuple_fraction = 0.1 # range 0.0-1.0
314#from_collapse_limit = 8
315#join_collapse_limit = 8 # 1 disables collapsing of explicit
316 # JOIN clauses
317
318
319#------------------------------------------------------------------------------
320# ERROR REPORTING AND LOGGING
321#------------------------------------------------------------------------------
322
323# - Where to Log -
324
325log_destination = 'syslog' # Valid values are combinations of
326 # stderr, csvlog, syslog, and eventlog,
327 # depending on platform. csvlog
328 # requires logging_collector to be on.
329
330# This is used when logging to stderr:
331logging_collector = on # Enable capturing of stderr and csvlog
332 # into log files. Required to be on for
333 # csvlogs.
334 # (change requires restart)
335
336# These are only used if logging_collector is on:
337#log_directory = 'pg_log' # directory where log files are written,
338 # can be absolute or relative to PGDATA
339#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
340 # can include strftime() escapes
341#log_file_mode = 0600 # creation mode for log files,
342 # begin with 0 to use octal notation
343#log_truncate_on_rotation = off # If on, an existing log file with the
344 # same name as the new log file will be
345 # truncated rather than appended to.
346 # But such truncation only occurs on
347 # time-driven rotation, not on restarts
348 # or size-driven rotation. Default is
349 # off, meaning append to existing files
350 # in all cases.
351#log_rotation_age = 1d # Automatic rotation of logfiles will
352 # happen after that time. 0 disables.
353#log_rotation_size = 10MB # Automatic rotation of logfiles will
354 # happen after that much log output.
355 # 0 disables.
356
357# These are relevant when logging to syslog:
358#syslog_facility = 'LOCAL0'
359#syslog_ident = 'postgres'
360
361# This is only relevant when logging to eventlog (win32):
362#event_source = 'PostgreSQL'
363
364# - When to Log -
365
366#client_min_messages = notice # values in order of decreasing detail:
367 # debug5
368 # debug4
369 # debug3
370 # debug2
371 # debug1
372 # log
373 # notice
374 # warning
375 # error
376
377#log_min_messages = warning # values in order of decreasing detail:
378 # debug5
379 # debug4
380 # debug3
381 # debug2
382 # debug1
383 # info
384 # notice
385 # warning
386 # error
387 # log
388 # fatal
389 # panic
390
391#log_min_error_statement = error # values in order of decreasing detail:
392 # debug5
393 # debug4
394 # debug3
395 # debug2
396 # debug1
397 # info
398 # notice
399 # warning
400 # error
401 # log
402 # fatal
403 # panic (effectively off)
404
405#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
406 # and their durations, > 0 logs only
407 # statements running at least this number
408 # of milliseconds
409
410
411# - What to Log -
412
413#debug_print_parse = off
414#debug_print_rewritten = off
415#debug_print_plan = off
416#debug_pretty_print = on
417#log_checkpoints = off
418#log_connections = off
419#log_disconnections = off
420#log_duration = off
421#log_error_verbosity = default # terse, default, or verbose messages
422#log_hostname = off
423log_line_prefix = '%t [%p-%l] %q%u@%d ' # special values:
424 # %a = application name
425 # %u = user name
426 # %d = database name
427 # %r = remote host and port
428 # %h = remote host
429 # %p = process ID
430 # %t = timestamp without milliseconds
431 # %m = timestamp with milliseconds
432 # %i = command tag
433 # %e = SQL state
434 # %c = session ID
435 # %l = session line number
436 # %s = session start timestamp
437 # %v = virtual transaction ID
438 # %x = transaction ID (0 if none)
439 # %q = stop here in non-session
440 # processes
441 # %% = '%'
442 # e.g. '<%u%%%d> '
443#log_lock_waits = off # log lock waits >= deadlock_timeout
444
445#MARKO: only for temporarly
446#log_statement = 'all' # none, ddl, mod, all
447
448#log_replication_commands = off
449#log_temp_files = -1 # log temporary files equal or larger
450 # than the specified size in kilobytes;
451 # -1 disables, 0 logs all temp files
452log_timezone = 'UTC'
453
454
455# - Process Title -
456
457#cluster_name = '' # added to process titles if nonempty
458 # (change requires restart)
459#update_process_title = on
460
461
462#------------------------------------------------------------------------------
463# RUNTIME STATISTICS
464#------------------------------------------------------------------------------
465
466# - Query/Index Statistics Collector -
467
468#track_activities = on
469#track_counts = on
470#track_io_timing = off
471#track_functions = none # none, pl, all
472#track_activity_query_size = 1024 # (change requires restart)
473stats_temp_directory = '/var/run/postgresql/9.5-main.pg_stat_tmp'
474
475
476# - Statistics Monitoring -
477
478#log_parser_stats = off
479#log_planner_stats = off
480#log_executor_stats = off
481#log_statement_stats = off
482
483
484#------------------------------------------------------------------------------
485# AUTOVACUUM PARAMETERS
486#------------------------------------------------------------------------------
487
488#autovacuum = on # Enable autovacuum subprocess? 'on'
489 # requires track_counts to also be on.
490#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
491 # their durations, > 0 logs only
492 # actions running at least this number
493 # of milliseconds.
494#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
495 # (change requires restart)
496#autovacuum_naptime = 1min # time between autovacuum runs
497#autovacuum_vacuum_threshold = 50 # min number of row updates before
498 # vacuum
499#autovacuum_analyze_threshold = 50 # min number of row updates before
500 # analyze
501#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
502#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
503#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
504 # (change requires restart)
505#autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age
506 # before forced vacuum
507 # (change requires restart)
508#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
509 # autovacuum, in milliseconds;
510 # -1 means use vacuum_cost_delay
511#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
512 # autovacuum, -1 means use
513 # vacuum_cost_limit
514
515
516#------------------------------------------------------------------------------
517# CLIENT CONNECTION DEFAULTS
518#------------------------------------------------------------------------------
519
520# - Statement Behavior -
521
522#search_path = '"$user", public' # schema names
523#default_tablespace = '' # a tablespace name, '' uses the default
524#temp_tablespaces = '' # a list of tablespace names, '' uses
525 # only default tablespace
526#check_function_bodies = on
527#default_transaction_isolation = 'read committed'
528#default_transaction_read_only = off
529#default_transaction_deferrable = off
530#session_replication_role = 'origin'
531#statement_timeout = 0 # in milliseconds, 0 is disabled
532#lock_timeout = 0 # in milliseconds, 0 is disabled
533#vacuum_freeze_min_age = 50000000
534#vacuum_freeze_table_age = 150000000
535#vacuum_multixact_freeze_min_age = 5000000
536#vacuum_multixact_freeze_table_age = 150000000
537#bytea_output = 'hex' # hex, escape
538#xmlbinary = 'base64'
539#xmloption = 'content'
540#gin_fuzzy_search_limit = 0
541#gin_pending_list_limit = 4MB
542
543# - Locale and Formatting -
544
545datestyle = 'iso, mdy'
546#intervalstyle = 'postgres'
547timezone = 'localtime'
548#timezone_abbreviations = 'Default' # Select the set of available time zone
549 # abbreviations. Currently, there are
550 # Default
551 # Australia (historical usage)
552 # India
553 # You can create your own file in
554 # share/timezonesets/.
555#extra_float_digits = 0 # min -15, max 3
556#client_encoding = sql_ascii # actually, defaults to database
557 # encoding
558
559# These settings are initialized by initdb, but they can be changed.
560lc_messages = 'en_US.UTF-8' # locale for system error message
561 # strings
562lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
563lc_numeric = 'en_US.UTF-8' # locale for number formatting
564lc_time = 'en_US.UTF-8' # locale for time formatting
565
566# default configuration for text search
567default_text_search_config = 'pg_catalog.english'
568
569# - Other Defaults -
570
571#dynamic_library_path = '$libdir'
572#local_preload_libraries = ''
573#session_preload_libraries = ''
574
575
576#------------------------------------------------------------------------------
577# LOCK MANAGEMENT
578#------------------------------------------------------------------------------
579
580#deadlock_timeout = 1s
581max_locks_per_transaction = 150 # min 10
582 # (change requires restart)
583# Note: Each lock table slot uses ~270 bytes of shared memory, and there are
584# max_locks_per_transaction * (max_connections + max_prepared_transactions)
585# lock table slots.
586#max_pred_locks_per_transaction = 64 # min 10
587 # (change requires restart)
588
589
590#------------------------------------------------------------------------------
591# VERSION/PLATFORM COMPATIBILITY
592#------------------------------------------------------------------------------
593
594# - Previous PostgreSQL Versions -
595
596#array_nulls = on
597#backslash_quote = safe_encoding # on, off, or safe_encoding
598#default_with_oids = off
599#escape_string_warning = on
600#lo_compat_privileges = off
601#operator_precedence_warning = off
602#quote_all_identifiers = off
603#sql_inheritance = on
604#standard_conforming_strings = on
605#synchronize_seqscans = on
606
607# - Other Platforms and Clients -
608
609#transform_null_equals = off
610
611
612#------------------------------------------------------------------------------
613# ERROR HANDLING
614#------------------------------------------------------------------------------
615
616#exit_on_error = off # terminate session on any error?
617#restart_after_crash = on # reinitialize after backend crash?
618
619
620#------------------------------------------------------------------------------
621# CONFIG FILE INCLUDES
622#------------------------------------------------------------------------------
623
624# These options allow settings to be loaded from files other than the
625# default postgresql.conf.
626
627#include_dir = 'conf.d' # include files ending in '.conf' from
628 # directory 'conf.d'
629#include_if_exists = 'exists.conf' # include file only if it exists
630#include = 'special.conf' # include file
631
632
633#------------------------------------------------------------------------------
634# CUSTOMIZED OPTIONS
635#------------------------------------------------------------------------------
636
637# Add settings for extensions here