]> git.immae.eu Git - github/fretlink/ansible-postgresql-role.git/blob - templates/postgresql.9.1.conf.j2
Merge pull request #11 from paulrbr-fl/postgresql-12
[github/fretlink/ansible-postgresql-role.git] / templates / postgresql.9.1.conf.j2
1 # {{ ansible_managed }}
2 # -----------------------------
3 # PostgreSQL configuration file
4 # -----------------------------
5 #
6 # This file consists of lines of the form:
7 #
8 # name = value
9 #
10 # (The "=" is optional.) Whitespace may be used. Comments are introduced with
11 # "#" anywhere on a line. The complete list of parameter names and allowed
12 # values can be found in the PostgreSQL documentation.
13 #
14 # The commented-out settings shown in this file represent the default values.
15 # Re-commenting a setting is NOT sufficient to revert it to the default value;
16 # you need to reload the server.
17 #
18 # This file is read on server startup and when the server receives a SIGHUP
19 # signal. If you edit the file on a running system, you have to SIGHUP the
20 # server for the changes to take effect, or use "pg_ctl reload". Some
21 # parameters, which are marked below, require a server shutdown and restart to
22 # take effect.
23 #
24 # Any parameter can also be given as a command-line option to the server, e.g.,
25 # "postgres -c log_connections=on". Some parameters can be changed at run time
26 # with the "SET" SQL command.
27 #
28 # Memory units: kB = kilobytes Time units: ms = milliseconds
29 # MB = megabytes s = seconds
30 # GB = gigabytes min = minutes
31 # h = hours
32 # d = days
33
34
35 #------------------------------------------------------------------------------
36 # FILE LOCATIONS
37 #------------------------------------------------------------------------------
38
39 # The default values of these variables are driven from the -D command-line
40 # option or PGDATA environment variable, represented here as ConfigDir.
41
42 data_directory = '/var/lib/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}' # use data in another directory
43 # (change requires restart)
44 hba_file = '/etc/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/pg_hba.conf' # host-based authentication file
45 # (change requires restart)
46 ident_file = '/etc/postgresql/{{ postgres_version }}/{{ postgres_cluster_name }}/pg_ident.conf' # ident configuration file
47 # (change requires restart)
48
49 # If external_pid_file is not explicitly set, no extra PID file is written.
50 external_pid_file = '/var/run/postgresql/{{ postgres_version }}-{{ postgres_cluster_name }}.pid' # write an extra PID file
51 # (change requires restart)
52
53
54 #------------------------------------------------------------------------------
55 # CONNECTIONS AND AUTHENTICATION
56 #------------------------------------------------------------------------------
57
58 # - Connection Settings -
59
60 listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}' # what IP address(es) to listen on;
61 # comma-separated list of addresses;
62 # defaults to 'localhost', '*' = all
63 # (change requires restart)
64 port = {{ postgres_port }} # (change requires restart)
65 max_connections = 400 # (change requires restart)
66 # Note: Increasing max_connections costs ~400 bytes of shared memory per
67 # connection slot, plus lock space (see max_locks_per_transaction).
68 #superuser_reserved_connections = 3 # (change requires restart)
69 unix_socket_directory = '/var/run/postgresql' # (change requires restart)
70 #unix_socket_group = '' # (change requires restart)
71 #unix_socket_permissions = 0777 # begin with 0 to use octal notation
72 # (change requires restart)
73 #bonjour = off # advertise server via Bonjour
74 # (change requires restart)
75 #bonjour_name = '' # defaults to the computer name
76 # (change requires restart)
77
78 # - Security and Authentication -
79
80 #authentication_timeout = 1min # 1s-600s
81 ssl = true # (change requires restart)
82 #ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers
83 # (change requires restart)
84 #ssl_renegotiation_limit = 512MB # amount of data between renegotiations
85 #password_encryption = on
86 #db_user_namespace = off
87
88 # Kerberos and GSSAPI
89 #krb_server_keyfile = ''
90 #krb_srvname = 'postgres' # (Kerberos only)
91 #krb_caseins_users = off
92
93 # - TCP Keepalives -
94 # see "man 7 tcp" for details
95
96 #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
97 # 0 selects the system default
98 #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
99 # 0 selects the system default
100 #tcp_keepalives_count = 0 # TCP_KEEPCNT;
101 # 0 selects the system default
102
103
104 #------------------------------------------------------------------------------
105 # RESOURCE USAGE (except WAL)
106 #------------------------------------------------------------------------------
107
108 # - Memory -
109
110 shared_buffers = 512MB # min 128kB
111 # (change requires restart)
112 temp_buffers = 24MB # min 800kB
113 #max_prepared_transactions = 0 # zero disables the feature
114 # (change requires restart)
115 # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
116 # per transaction slot, plus lock space (see max_locks_per_transaction).
117 # It is not advisable to set max_prepared_transactions nonzero unless you
118 # actively intend to use prepared transactions.
119 #work_mem = 1MB # min 64kB
120 #maintenance_work_mem = 16MB # min 1MB
121 #max_stack_depth = 2MB # min 100kB
122
123 work_mem = 512MB
124 maintenance_work_mem = 1024MB
125
126
127 # - Kernel Resource Usage -
128
129 #max_files_per_process = 1000 # min 25
130 # (change requires restart)
131 #shared_preload_libraries = '' # (change requires restart)
132
133 # - Cost-Based Vacuum Delay -
134
135 #vacuum_cost_delay = 0ms # 0-100 milliseconds
136 #vacuum_cost_page_hit = 1 # 0-10000 credits
137 #vacuum_cost_page_miss = 10 # 0-10000 credits
138 #vacuum_cost_page_dirty = 20 # 0-10000 credits
139 #vacuum_cost_limit = 200 # 1-10000 credits
140
141 # - Background Writer -
142
143 bgwriter_delay = 2000ms # 10-10000ms between rounds
144 #bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
145 #bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round
146
147 # - Asynchronous Behavior -
148
149 #effective_io_concurrency = 1 # 1-1000. 0 disables prefetching
150
151
152 #------------------------------------------------------------------------------
153 # WRITE AHEAD LOG
154 #------------------------------------------------------------------------------
155
156 # - Settings -
157
158 #barman and replication
159 #wal_level = 'archive' # For PostgreSQL >= 9.0
160 wal_level = 'hot_standby' # For PostgreSQL >= 9.0
161
162 {% if postgres_archive_enabled %}
163 archive_mode = on
164 archive_command = 'rsync -a %p barman@{{ postgres_barman_server }}:/var/lib/barman/{{ barman_directory }}/incoming/%f'
165 {% else %}
166 archive_mode = off
167 archive_command = ''
168 {% endif %}
169
170 max_wal_senders = 5
171 checkpoint_segments = 8
172 wal_keep_segments = 16
173 hot_standby = on
174 wal_level = hot_standby # minimal, archive, or hot_standby
175
176 # (change requires restart)
177 {% if postgres_fsync_enabled %}
178 #fsync = on # turns forced synchronization on or off
179 #synchronous_commit = on # synchronization level;
180 {% else %}
181 fsync = off # turns forced synchronization on or off
182 synchronous_commit = off # synchronization level;
183 {% endif %}
184 #wal_sync_method = fsync # the default is the first option
185 # supported by the operating system:
186 # open_datasync
187 # fdatasync (default on Linux)
188 # fsync
189 # fsync_writethrough
190 # open_sync
191 #full_page_writes = on # recover from partial page writes
192 #wal_buffers = -1 # min 32kB, -1 sets based on shared_buffers
193 # (change requires restart)
194 #wal_writer_delay = 200ms # 1-10000 milliseconds
195
196 #commit_delay = 0 # range 0-100000, in microseconds
197 #commit_siblings = 5 # range 1-1000
198
199 # - Checkpoints -
200
201 #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
202 #checkpoint_timeout = 5min # range 30s-1h
203 #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
204 #checkpoint_warning = 30s # 0 disables
205
206 # - Archiving -
207
208 #archive_mode = off # allows archiving to be done
209 # (change requires restart)
210 #archive_command = '' # command to use to archive a logfile segment
211 #archive_timeout = 0 # force a logfile segment switch after this
212 # number of seconds; 0 disables
213
214
215 #------------------------------------------------------------------------------
216 # REPLICATION
217 #------------------------------------------------------------------------------
218
219 # - Master Server -
220
221 # These settings are ignored on a standby server
222
223 #max_wal_senders = 0 # max number of walsender processes
224 # (change requires restart)
225 #wal_sender_delay = 1s # walsender cycle time, 1-10000 milliseconds
226 #wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
227 #vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
228 #replication_timeout = 60s # in milliseconds; 0 disables
229 #synchronous_standby_names = '' # standby servers that provide sync rep
230 # comma-separated list of application_name
231 # from standby(s); '*' = all
232
233 # - Standby Servers -
234
235 # These settings are ignored on a master server
236
237 #hot_standby = off # "on" allows queries during recovery
238 # (change requires restart)
239 #max_standby_archive_delay = 30s # max delay before canceling queries
240 # when reading WAL from archive;
241 # -1 allows indefinite delay
242 max_standby_streaming_delay = 600s
243 #max_standby_streaming_delay = 30s # max delay before canceling queries
244 # when reading streaming WAL;
245 # -1 allows indefinite delay
246 #wal_receiver_status_interval = 10s # send replies at least this often
247 # 0 disables
248 #hot_standby_feedback = off # send info from standby to prevent
249 # query conflicts
250
251
252 #------------------------------------------------------------------------------
253 # QUERY TUNING
254 #------------------------------------------------------------------------------
255
256 # - Planner Method Configuration -
257
258 #enable_bitmapscan = on
259 #enable_hashagg = on
260 #enable_hashjoin = on
261 #enable_indexscan = on
262 #enable_material = on
263 #enable_mergejoin = on
264 #enable_nestloop = on
265 #enable_seqscan = on
266 #enable_sort = on
267 #enable_tidscan = on
268
269 # - Planner Cost Constants -
270
271 #seq_page_cost = 1.0 # measured on an arbitrary scale
272 #random_page_cost = 4.0 # same scale as above
273 #cpu_tuple_cost = 0.01 # same scale as above
274 #cpu_index_tuple_cost = 0.005 # same scale as above
275 #cpu_operator_cost = 0.0025 # same scale as above
276 #effective_cache_size = 128MB
277
278 # - Genetic Query Optimizer -
279
280 #geqo = on
281 #geqo_threshold = 12
282 #geqo_effort = 5 # range 1-10
283 #geqo_pool_size = 0 # selects default based on effort
284 #geqo_generations = 0 # selects default based on effort
285 #geqo_selection_bias = 2.0 # range 1.5-2.0
286 #geqo_seed = 0.0 # range 0.0-1.0
287
288 # - Other Planner Options -
289
290 #default_statistics_target = 100 # range 1-10000
291 #constraint_exclusion = partition # on, off, or partition
292 #cursor_tuple_fraction = 0.1 # range 0.0-1.0
293 #from_collapse_limit = 8
294 #join_collapse_limit = 8 # 1 disables collapsing of explicit
295 # JOIN clauses
296
297
298 #------------------------------------------------------------------------------
299 # ERROR REPORTING AND LOGGING
300 #------------------------------------------------------------------------------
301
302 # - Where to Log -
303
304 #log_destination = 'stderr' # Valid values are combinations of
305 # stderr, csvlog, syslog, and eventlog,
306 # depending on platform. csvlog
307 # requires logging_collector to be on.
308
309 # This is used when logging to stderr:
310 #logging_collector = off # Enable capturing of stderr and csvlog
311 # into log files. Required to be on for
312 # csvlogs.
313 # (change requires restart)
314
315 # These are only used if logging_collector is on:
316 #log_directory = 'pg_log' # directory where log files are written,
317 # can be absolute or relative to PGDATA
318 #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
319 # can include strftime() escapes
320 #log_file_mode = 0600 # creation mode for log files,
321 # begin with 0 to use octal notation
322 #log_truncate_on_rotation = off # If on, an existing log file with the
323 # same name as the new log file will be
324 # truncated rather than appended to.
325 # But such truncation only occurs on
326 # time-driven rotation, not on restarts
327 # or size-driven rotation. Default is
328 # off, meaning append to existing files
329 # in all cases.
330 #log_rotation_age = 1d # Automatic rotation of logfiles will
331 # happen after that time. 0 disables.
332 #log_rotation_size = 10MB # Automatic rotation of logfiles will
333 # happen after that much log output.
334 # 0 disables.
335
336 # These are relevant when logging to syslog:
337 #syslog_facility = 'LOCAL0'
338 #syslog_ident = 'postgres'
339
340 #silent_mode = off # Run server silently.
341 # DO NOT USE without syslog or
342 # logging_collector
343 # (change requires restart)
344
345
346 # - When to Log -
347
348 client_min_messages = notice # values in order of decreasing detail:
349 # debug5
350 # debug4
351 # debug3
352 # debug2
353 # debug1
354 # log
355 # notice
356 # warning
357 # error
358
359 log_min_messages = warning # values in order of decreasing detail:
360 # debug5
361 # debug4
362 # debug3
363 # debug2
364 # debug1
365 # info
366 # notice
367 # warning
368 # error
369 # log
370 # fatal
371 # panic
372
373 log_min_error_statement = error # values in order of decreasing detail:
374 # debug5
375 # debug4
376 # debug3
377 # debug2
378 # debug1
379 # info
380 # notice
381 # warning
382 # error
383 # log
384 # fatal
385 # panic (effectively off)
386
387 log_min_duration_statement = 10000 # -1 is disabled, 0 logs all statements
388 # and their durations, > 0 logs only
389 # statements running at least this number
390 # of milliseconds
391
392
393 # - What to Log -
394
395 #debug_print_parse = off
396 #debug_print_rewritten = off
397 #debug_print_plan = off
398 #debug_pretty_print = on
399 #log_checkpoints = off
400 #log_connections = off
401 #log_disconnections = off
402 #log_duration = off
403 #log_error_verbosity = default # terse, default, or verbose messages
404 #log_hostname = off
405
406 log_line_prefix = '{{ postgres_log_line_prefix }}'
407 #log_line_prefix = '%t ' # special values:
408 # %a = application name
409 # %u = user name
410 # %d = database name
411 # %r = remote host and port
412 # %h = remote host
413 # %p = process ID
414 # %t = timestamp without milliseconds
415 # %m = timestamp with milliseconds
416 # %i = command tag
417 # %e = SQL state
418 # %c = session ID
419 # %l = session line number
420 # %s = session start timestamp
421 # %v = virtual transaction ID
422 # %x = transaction ID (0 if none)
423 # %q = stop here in non-session
424 # processes
425 # %% = '%'
426 # e.g. '<%u%%%d> '
427 #log_lock_waits = off # log lock waits >= deadlock_timeout
428 #log_statement = 'none' # none, ddl, mod, all
429 #log_temp_files = -1 # log temporary files equal or larger
430 # than the specified size in kilobytes;
431 # -1 disables, 0 logs all temp files
432 log_timezone = 'GMT'
433
434
435 #------------------------------------------------------------------------------
436 # RUNTIME STATISTICS
437 #------------------------------------------------------------------------------
438
439 # - Query/Index Statistics Collector -
440
441 #track_activities = on
442 #track_counts = on
443 #track_functions = none # none, pl, all
444 #track_activity_query_size = 1024 # (change requires restart)
445 #update_process_title = on
446 stats_temp_directory = '/var/run/postgresql/{{ postgres_version }}-{{ postgres_cluster_name }}.pg_stat_tmp'
447
448
449 # - Statistics Monitoring -
450
451 #log_parser_stats = off
452 #log_planner_stats = off
453 #log_executor_stats = off
454 #log_statement_stats = off
455
456
457 #------------------------------------------------------------------------------
458 # AUTOVACUUM PARAMETERS
459 #------------------------------------------------------------------------------
460
461 autovacuum = on # Enable autovacuum subprocess? 'on'
462 # requires track_counts to also be on.
463 #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and
464 # their durations, > 0 logs only
465 # actions running at least this number
466 # of milliseconds.
467 #autovacuum_max_workers = 3 # max number of autovacuum subprocesses
468 # (change requires restart)
469 #autovacuum_naptime = 1min # time between autovacuum runs
470 #autovacuum_vacuum_threshold = 50 # min number of row updates before
471 # vacuum
472 #autovacuum_analyze_threshold = 50 # min number of row updates before
473 # analyze
474 #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
475 #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
476 #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum
477 # (change requires restart)
478 #autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for
479 # autovacuum, in milliseconds;
480 # -1 means use vacuum_cost_delay
481 #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for
482 # autovacuum, -1 means use
483 # vacuum_cost_limit
484
485
486 #------------------------------------------------------------------------------
487 # CLIENT CONNECTION DEFAULTS
488 #------------------------------------------------------------------------------
489
490 # - Statement Behavior -
491
492 #search_path = '"$user",public' # schema names
493 #default_tablespace = '' # a tablespace name, '' uses the default
494 #temp_tablespaces = '' # a list of tablespace names, '' uses
495 # only default tablespace
496 #check_function_bodies = on
497 #default_transaction_isolation = 'read committed'
498 #default_transaction_read_only = off
499 #default_transaction_deferrable = off
500 #session_replication_role = 'origin'
501 #statement_timeout = 0 # in milliseconds, 0 is disabled
502 #vacuum_freeze_min_age = 50000000
503 #vacuum_freeze_table_age = 150000000
504 #bytea_output = 'hex' # hex, escape
505 #xmlbinary = 'base64'
506 #xmloption = 'content'
507
508 # - Locale and Formatting -
509
510 datestyle = '{{ postgres_datestyle }}'
511 #intervalstyle = 'postgres'
512 #timezone = '(defaults to server environment setting)'
513 {% if postgres_timezone is defined %}
514 timezone = '{{ postgres_timezone }}'
515 {% endif %}
516 #timezone_abbreviations = 'Default' # Select the set of available time zone
517 # abbreviations. Currently, there are
518 # Default
519 # Australia (historical usage)
520 # India
521 # You can create your own file in
522 # share/timezonesets/.
523 #extra_float_digits = 0 # min -15, max 3
524 #client_encoding = sql_ascii # actually, defaults to database
525 # encoding
526
527 # These settings are initialized by initdb, but they can be changed.
528 lc_messages = '{{ postgres_locale_system }}' # locale for system error message
529 # strings
530 lc_monetary = '{{ postgres_locale_formats }}' # locale for monetary formatting
531 lc_numeric = '{{ postgres_locale_formats }}' # locale for number formatting
532 lc_time = '{{ postgres_locale_formats }}' # locale for time formatting
533
534 # default configuration for text search
535 default_text_search_config = '{{ postgres_text_search_config }}'
536
537 # - Other Defaults -
538
539 #dynamic_library_path = '$libdir'
540 #local_preload_libraries = ''
541
542
543 #------------------------------------------------------------------------------
544 # LOCK MANAGEMENT
545 #------------------------------------------------------------------------------
546
547 #deadlock_timeout = 1s
548 #max_locks_per_transaction = 64 # min 10
549 # (change requires restart)
550 # Note: Each lock table slot uses ~270 bytes of shared memory, and there are
551 # max_locks_per_transaction * (max_connections + max_prepared_transactions)
552 # lock table slots.
553 #max_pred_locks_per_transaction = 64 # min 10
554 # (change requires restart)
555
556 #------------------------------------------------------------------------------
557 # VERSION/PLATFORM COMPATIBILITY
558 #------------------------------------------------------------------------------
559
560 # - Previous PostgreSQL Versions -
561
562 #array_nulls = on
563 #backslash_quote = safe_encoding # on, off, or safe_encoding
564 #default_with_oids = off
565 #escape_string_warning = on
566 #lo_compat_privileges = off
567 #quote_all_identifiers = off
568 #sql_inheritance = on
569 #standard_conforming_strings = on
570 #synchronize_seqscans = on
571
572 # - Other Platforms and Clients -
573
574 #transform_null_equals = off
575
576
577 #------------------------------------------------------------------------------
578 # ERROR HANDLING
579 #------------------------------------------------------------------------------
580
581 #exit_on_error = off # terminate session on any error?
582 #restart_after_crash = on # reinitialize after backend crash?
583
584
585 #------------------------------------------------------------------------------
586 # CUSTOMIZED OPTIONS
587 #------------------------------------------------------------------------------
588
589 #custom_variable_classes = '' # list of custom variable class names