postgresql.conf 20 KB

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