postgresql.conf 20 KB

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