postgresql.conf.j2 21 KB

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