· 8 years ago · Apr 20, 2018, 04:20 PM
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.4/main' # use data in another directory
42 # (change requires restart)
43hba_file = '/etc/postgresql/9.4/main/pg_hba.conf' # host-based authentication file
44 # (change requires restart)
45ident_file = '/etc/postgresql/9.4/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.4-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 = 100 # (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).
67#superuser_reserved_connections = 3 # (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
81#ssl = 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)
86#ssl_renegotiation_limit = 0 # amount of data between renegotiations
87ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' # (change requires restart)
88ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' # (change requires restart)
89#ssl_ca_file = '' # (change requires restart)
90#ssl_crl_file = '' # (change requires restart)
91#password_encryption = on
92#db_user_namespace = off
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 = 128MB # min 128kB
116 # (change requires restart)
117#huge_pages = try # on, off, or try
118 # (change requires restart)
119#temp_buffers = 8MB # 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.
126#work_mem = 4MB # min 64kB
127#maintenance_work_mem = 64MB # 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)
147#shared_preload_libraries = '' # (change requires restart)
148
149# - Cost-Based Vacuum Delay -
150
151#vacuum_cost_delay = 0 # 0-100 milliseconds
152#vacuum_cost_page_hit = 1 # 0-10000 credits
153#vacuum_cost_page_miss = 10 # 0-10000 credits
154#vacuum_cost_page_dirty = 20 # 0-10000 credits
155#vacuum_cost_limit = 200 # 1-10000 credits
156
157# - Background Writer -
158
159#bgwriter_delay = 200ms # 10-10000ms between rounds
160#bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
161#bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
162
163# - Asynchronous Behavior -
164
165#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
166#max_worker_processes = 8
167
168
169#------------------------------------------------------------------------------
170# WRITE AHEAD LOG
171#------------------------------------------------------------------------------
172
173# - Settings -
174
175wal_level = logical # minimal, archive, hot_standby, or logical
176 # (change requires restart)
177#fsync = on # turns forced synchronization on or off
178#synchronous_commit = local # synchronization level;
179 # off, local, remote_write, or on
180#wal_sync_method = fsync # the default is the first option
181 # supported by the operating system:
182 # open_datasync
183 # fdatasync (default on Linux)
184 # fsync
185 # fsync_writethrough
186 # open_sync
187#full_page_writes = on # recover from partial page writes
188#wal_log_hints = off # also do full page writes of non-critical updates
189 # (change requires restart)
190#wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
191 # (change requires restart)
192#wal_writer_delay = 200ms # 1-10000 milliseconds
193
194#commit_delay = 0 # range 0-100000, in microseconds
195#commit_siblings = 5 # range 1-1000
196
197# - Checkpoints -
198
199#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
200#checkpoint_timeout = 5min # range 30s-1h
201#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
202max_connections = 800
203#checkpoint_warning = 30s # 0 disables
204
205# - Archiving -
206
207#archive_mode = off # allows archiving to be done
208 # (change requires restart)
209#archive_command = '' # command to use to archive a logfile segment
210 # placeholders: %p = path of file to archive
211 # %f = file name only
212 # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
213#archive_timeout = 0 # force a logfile segment switch after this
214 # number of seconds; 0 disables
215
216
217#------------------------------------------------------------------------------
218# REPLICATION
219#------------------------------------------------------------------------------
220
221# - Sending Server(s) -
222
223# Set these on the master and on any standby that will send replication data.
224
225max_wal_senders = 3 # max number of walsender processes
226 # (change requires restart)
227wal_keep_segments = 256 # in logfile segments, 16MB each; 0 disables
228wal_sender_timeout = 0 # in milliseconds; 0 disables
229
230max_replication_slots = 3 # max number of replication slots
231 # (change requires restart)
232
233# - Master Server -
234
235# These settings are ignored on a standby server.
236
237#synchronous_standby_names = 'pgslave001' # standby servers that provide sync rep
238 # comma-separated list of application_name
239 # from standby(s); '*' = all
240#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
241
242# - Standby Servers -
243
244# These settings are ignored on a master server.
245
246hot_standby = on # "on" allows queries during recovery
247 # (change requires restart)
248#max_standby_archive_delay = 30s # max delay before canceling queries
249 # when reading WAL from archive;
250 # -1 allows indefinite delay
251#max_standby_streaming_delay = 30s # max delay before canceling queries
252 # when reading streaming WAL;
253 # -1 allows indefinite delay
254#wal_receiver_status_interval = 10s # send replies at least this often
255 # 0 disables
256#hot_standby_feedback = off # send info from standby to prevent
257 # query conflicts
258#wal_receiver_timeout = 60s # time that receiver waits for
259 # communication from master
260 # in milliseconds; 0 disables
261
262
263#------------------------------------------------------------------------------
264# QUERY TUNING
265#------------------------------------------------------------------------------
266
267# - Planner Method Configuration -
268
269#enable_bitmapscan = on
270#enable_hashagg = on
271#enable_hashjoin = on
272#enable_indexscan = on
273#enable_indexonlyscan = on
274#enable_material = on
275#enable_mergejoin = on
276#enable_nestloop = on
277#enable_seqscan = on
278#enable_sort = on
279#enable_tidscan = on
280
281# - Planner Cost Constants -
282
283#seq_page_cost = 1.0 # measured on an arbitrary scale
284#random_page_cost = 4.0 # same scale as above
285#cpu_tuple_cost = 0.01 # same scale as above
286#cpu_index_tuple_cost = 0.005 # same scale as above
287#cpu_operator_cost = 0.0025 # same scale as above
288#effective_cache_size = 4GB
289
290# - Genetic Query Optimizer -
291
292#geqo = on
293#geqo_threshold = 12
294#geqo_effort = 5 # range 1-10
295#geqo_pool_size = 0 # selects default based on effort
296#geqo_generations = 0 # selects default based on effort
297#geqo_selection_bias = 2.0 # range 1.5-2.0
298#geqo_seed = 0.0 # range 0.0-1.0
299
300# - Other Planner Options -
301
302#default_statistics_target = 100 # range 1-10000
303#constraint_exclusion = partition # on, off, or partition
304#cursor_tuple_fraction = 0.1 # range 0.0-1.0
305#from_collapse_limit = 8
306#join_collapse_limit = 8 # 1 disables collapsing of explicit
307 # JOIN clauses
308
309
310#------------------------------------------------------------------------------
311# ERROR REPORTING AND LOGGING
312#------------------------------------------------------------------------------
313
314# - Where to Log -
315
316#log_destination = 'stderr' # Valid values are combinations of
317 # stderr, csvlog, syslog, and eventlog,
318 # depending on platform. csvlog
319 # requires logging_collector to be on.
320
321# This is used when logging to stderr:
322#logging_collector = off # Enable capturing of stderr and csvlog
323 # into log files. Required to be on for
324 # csvlogs.
325 # (change requires restart)
326
327# These are only used if logging_collector is on:
328#log_directory = 'pg_log' # directory where log files are written,
329 # can be absolute or relative to PGDATA
330#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
331 # can include strftime() escapes
332#log_file_mode = 0600 # creation mode for log files,
333 # begin with 0 to use octal notation
334#log_truncate_on_rotation = off # If on, an existing log file with the
335 # same name as the new log file will be
336 # truncated rather than appended to.
337 # But such truncation only occurs on
338 # time-driven rotation, not on restarts
339 # or size-driven rotation. Default is
340 # off, meaning append to existing files
341 # in all cases.
342#log_rotation_age = 1d # Automatic rotation of logfiles will
343 # happen after that time. 0 disables.
344#log_rotation_size = 10MB # Automatic rotation of logfiles will
345 # happen after that much log output.
346 # 0 disables.
347
348# These are relevant when logging to syslog:
349#syslog_facility = 'LOCAL0'
350#syslog_ident = 'postgres'
351
352# This is only relevant when logging to eventlog (win32):
353#event_source = 'PostgreSQL'
354
355# - When to Log -
356
357#client_min_messages = notice # values in order of decreasing detail:
358 # debug5
359 # debug4
360 # debug3
361 # debug2
362 # debug1
363 # log
364 # notice
365 # warning
366 # error
367
368#log_min_messages = warning # values in order of decreasing detail:
369 # debug5
370 # debug4
371 # debug3
372 # debug2
373 # debug1
374 # info
375 # notice
376 # warning
377 # error
378 # log
379 # fatal
380 # panic
381
382#log_min_error_statement = error # values in order of decreasing detail:
383 # debug5
384 # debug4
385 # debug3
386 # debug2
387 # debug1
388 # info
389 # notice
390 # warning
391 # error
392 # log
393 # fatal
394 # panic (effectively off)
395
396#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
397 # and their durations, > 0 logs only
398 # statements running at least this number
399 # of milliseconds
400
401
402# - What to Log -
403
404#debug_print_parse = off
405#debug_print_rewritten = off
406#debug_print_plan = off
407#debug_pretty_print = on
408#log_checkpoints = off
409#log_connections = off
410#log_disconnections = off
411#log_duration = off
412#log_error_verbosity = default # terse, default, or verbose messages
413#log_hostname = off
414log_line_prefix = '%t [%p-%l] %q%u@%d ' # special values:
415 # %a = application name
416 # %u = user name
417 # %d = database name
418 # %r = remote host and port
419 # %h = remote host
420 # %p = process ID
421 # %t = timestamp without milliseconds
422 # %m = timestamp with milliseconds
423 # %i = command tag
424 # %e = SQL state
425 # %c = session ID
426 # %l = session line number
427 # %s = session start timestamp
428 # %v = virtual transaction ID
429 # %x = transaction ID (0 if none)
430 # %q = stop here in non-session
431 # processes
432 # %% = '%'
433 # e.g. '<%u%%%d> '
434#log_lock_waits = off # log lock waits >= deadlock_timeout
435#log_statement = 'none' # none, ddl, mod, all
436#log_temp_files = -1 # log temporary files equal or larger
437 # than the specified size in kilobytes;
438 # -1 disables, 0 logs all temp files
439log_timezone = 'UTC'
440
441
442#------------------------------------------------------------------------------
443# RUNTIME STATISTICS
444#------------------------------------------------------------------------------
445
446# - Query/Index Statistics Collector -
447
448#track_activities = on
449#track_counts = on
450#track_io_timing = off
451#track_functions = none # none, pl, all
452#track_activity_query_size = 1024 # (change requires restart)
453#update_process_title = on
454stats_temp_directory = '/var/run/postgresql/9.4-main.pg_stat_tmp'
455
456
457# - Statistics Monitoring -
458
459#log_parser_stats = off
460#log_planner_stats = off
461#log_executor_stats = off
462#log_statement_stats = off
463
464
465#------------------------------------------------------------------------------
466# AUTOVACUUM PARAMETERS
467#------------------------------------------------------------------------------
468
469#autovacuum = on # Enable autovacuum subprocess? 'on'
470 # requires track_counts to also be on.
471#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
472 # their durations, > 0 logs only
473 # actions running at least this number
474 # of milliseconds.
475#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
476 # (change requires restart)
477#autovacuum_naptime = 1min # time between autovacuum runs
478#autovacuum_vacuum_threshold = 50 # min number of row updates before
479 # vacuum
480#autovacuum_analyze_threshold = 50 # min number of row updates before
481 # analyze
482#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
483#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
484#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
485 # (change requires restart)
486#autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age
487 # before forced vacuum
488 # (change requires restart)
489#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
490 # autovacuum, in milliseconds;
491 # -1 means use vacuum_cost_delay
492#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
493 # autovacuum, -1 means use
494 # vacuum_cost_limit
495
496
497#------------------------------------------------------------------------------
498# CLIENT CONNECTION DEFAULTS
499#------------------------------------------------------------------------------
500
501# - Statement Behavior -
502
503#search_path = '"$user",public' # schema names
504#default_tablespace = '' # a tablespace name, '' uses the default
505#temp_tablespaces = '' # a list of tablespace names, '' uses
506 # only default tablespace
507#check_function_bodies = on
508#default_transaction_isolation = 'read committed'
509#default_transaction_read_only = off
510#default_transaction_deferrable = off
511#session_replication_role = 'origin'
512#statement_timeout = 0 # in milliseconds, 0 is disabled
513#lock_timeout = 0 # in milliseconds, 0 is disabled
514#vacuum_freeze_min_age = 50000000
515#vacuum_freeze_table_age = 150000000
516#vacuum_multixact_freeze_min_age = 5000000
517#vacuum_multixact_freeze_table_age = 150000000
518#bytea_output = 'hex' # hex, escape
519#xmlbinary = 'base64'
520#xmloption = 'content'
521#gin_fuzzy_search_limit = 0
522
523# - Locale and Formatting -
524
525datestyle = 'iso, mdy'
526#intervalstyle = 'postgres'
527timezone = 'UTC'
528#timezone_abbreviations = 'Default' # Select the set of available time zone
529 # abbreviations. Currently, there are
530 # Default
531 # Australia (historical usage)
532 # India
533 # You can create your own file in
534 # share/timezonesets/.
535#extra_float_digits = 0 # min -15, max 3
536#client_encoding = sql_ascii # actually, defaults to database
537 # encoding
538
539# These settings are initialized by initdb, but they can be changed.
540lc_messages = 'en_US.UTF-8' # locale for system error message
541 # strings
542lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
543lc_numeric = 'en_US.UTF-8' # locale for number formatting
544lc_time = 'en_US.UTF-8' # locale for time formatting
545
546# default configuration for text search
547default_text_search_config = 'pg_catalog.english'
548
549# - Other Defaults -
550
551#dynamic_library_path = '$libdir'
552#local_preload_libraries = ''
553#session_preload_libraries = ''
554
555
556#------------------------------------------------------------------------------
557# LOCK MANAGEMENT
558#------------------------------------------------------------------------------
559
560#deadlock_timeout = 1s
561#max_locks_per_transaction = 64 # min 10
562 # (change requires restart)
563# Note: Each lock table slot uses ~270 bytes of shared memory, and there are
564# max_locks_per_transaction * (max_connections + max_prepared_transactions)
565# lock table slots.
566#max_pred_locks_per_transaction = 64 # min 10
567 # (change requires restart)
568
569
570#------------------------------------------------------------------------------
571# VERSION/PLATFORM COMPATIBILITY
572#------------------------------------------------------------------------------
573
574# - Previous PostgreSQL Versions -
575
576#array_nulls = on
577#backslash_quote = safe_encoding # on, off, or safe_encoding
578#default_with_oids = off
579#escape_string_warning = on
580#lo_compat_privileges = off
581#quote_all_identifiers = off
582#sql_inheritance = on
583#standard_conforming_strings = on
584#synchronize_seqscans = on
585
586# - Other Platforms and Clients -
587
588#transform_null_equals = off
589
590
591#------------------------------------------------------------------------------
592# ERROR HANDLING
593#------------------------------------------------------------------------------
594
595#exit_on_error = off # terminate session on any error?
596#restart_after_crash = on # reinitialize after backend crash?
597
598
599#------------------------------------------------------------------------------
600# CONFIG FILE INCLUDES
601#------------------------------------------------------------------------------
602
603# These options allow settings to be loaded from files other than the
604# default postgresql.conf.
605
606#include_dir = 'conf.d' # include files ending in '.conf' from
607 # directory 'conf.d'
608#include_if_exists = 'exists.conf' # include file only if it exists
609#include = 'special.conf' # include file
610
611
612#------------------------------------------------------------------------------
613# CUSTOMIZED OPTIONS
614#------------------------------------------------------------------------------
615
616# Add settings for extensions here