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