From c03893ec37b5e3993304023f8ab2294dd3b3621a Mon Sep 17 00:00:00 2001 From: Florent THOMAS Date: Sun, 21 May 2023 16:28:54 +0200 Subject: [PATCH 1/7] Rocky9 --- tasks/install_rhel.yml | 166 ++++++++++++++++++++--------------------- tasks/main.yml | 2 +- vars/RedHat_9.yml | 27 +++++++ 3 files changed, 111 insertions(+), 84 deletions(-) create mode 100644 vars/RedHat_9.yml diff --git a/tasks/install_rhel.yml b/tasks/install_rhel.yml index f8a755bf4..b73e28783 100644 --- a/tasks/install_rhel.yml +++ b/tasks/install_rhel.yml @@ -3,95 +3,95 @@ # The standard ca-certs are needed because without them yum will fail to # validate www.postgresql.org (or probably any other source). - - block: - - name: PostgreSQL | Install all the required dependencies (yum) | RHEL - yum: - name: "{{ postgresql_packages }}" - state: present - update_cache: yes +- block: + - name: PostgreSQL | Install all the required dependencies (yum) | RHEL + yum: + name: "{{ postgresql_packages }}" + state: present + update_cache: yes - - name: PostgreSQL | Add PostgreSQL repository | RHEL - yum_repository: - name: postgresql - description: postgresql yum repo - baseurl: "{{ postgresql_yum_repository_baseurl }}" - gpgkey: "{{ postgresql_yum_repository_gpgkey }}" - enabled: yes - when: postgresql_install_repository + - name: PostgreSQL | Add PostgreSQL repository | RHEL + yum_repository: + name: postgresql + description: postgresql yum repo + baseurl: "{{ postgresql_yum_repository_baseurl }}" + gpgkey: "{{ postgresql_yum_repository_gpgkey }}" + enabled: yes + when: postgresql_install_repository - - name: PostgreSQL | Disable postgresql module (necessary for RHEL8+) - command: - cmd: dnf module disable postgresql -y - when: "ansible_distribution_major_version == '8'" - register: disable_postgresql_module - changed_when: - - "disable_postgresql_module.rc == 0" - - "'Disabling modules:\\n postgresql' in disable_postgresql_module.stdout" + - name: PostgreSQL | Disable postgresql module (necessary for RHEL8+) + command: + cmd: dnf module disable postgresql -y + when: "ansible_distribution_major_version | int >= 8" + register: disable_postgresql_module + changed_when: + - "disable_postgresql_module.rc == 0" + - "'Disabling modules:\\n postgresql' in disable_postgresql_module.stdout" - - name: PostgreSQL | Install PostgreSQL | RHEL - yum: - name: - - "postgresql{{ postgresql_version_terse }}-server" - - "postgresql{{ postgresql_version_terse }}" - - "postgresql{{ postgresql_version_terse }}-contrib" - state: present - update_cache: yes - environment: "{{ postgresql_env }}" + - name: PostgreSQL | Install PostgreSQL | RHEL + yum: + name: + - "postgresql{{ postgresql_version_terse }}-server" + - "postgresql{{ postgresql_version_terse }}" + - "postgresql{{ postgresql_version_terse }}-contrib" + state: present + update_cache: yes + environment: "{{ postgresql_env }}" - - name: PostgreSQL | Setup service users profile | RHEL - template: - src: pgsql_profile.j2 - dest: "~{{ postgresql_service_user }}/.pgsql_profile" - owner: "{{ postgresql_service_user }}" - group: "{{ postgresql_service_group }}" - mode: 0700 - when: postgresql_service_user_pgsql_profile + - name: PostgreSQL | Setup service users profile | RHEL + template: + src: pgsql_profile.j2 + dest: "~{{ postgresql_service_user }}/.pgsql_profile" + owner: "{{ postgresql_service_user }}" + group: "{{ postgresql_service_group }}" + mode: 0700 + when: postgresql_service_user_pgsql_profile - - name: PostgreSQL | Create ~/pgtab.example | RHEL - template: - src: pgtab.j2 - dest: "~{{ postgresql_service_user }}/pgtab.example" - owner: "{{ postgresql_service_user }}" - group: "{{ postgresql_service_group }}" - mode: 0644 - when: postgresql_service_user_pgsql_profile + - name: PostgreSQL | Create ~/pgtab.example | RHEL + template: + src: pgtab.j2 + dest: "~{{ postgresql_service_user }}/pgtab.example" + owner: "{{ postgresql_service_user }}" + group: "{{ postgresql_service_group }}" + mode: 0644 + when: postgresql_service_user_pgsql_profile - - name: PostgreSQL | Create ~/pgtab header | RHEL - lineinfile: - path: "~{{ postgresql_service_user }}/pgtab" - owner: "{{ postgresql_service_user }}" - group: "{{ postgresql_service_group }}" - mode: 0644 - create: yes - insertbefore: BOF - regexp: "^# pgclustername :.*$" - line: "# pgclustername : pgtabversion : pgrelease : pgport : pgdatabase : pgroot : pgbindir : [pgdata] : [pgwalarch] : [pgbackups]" - when: postgresql_service_user_pgsql_profile + - name: PostgreSQL | Create ~/pgtab header | RHEL + lineinfile: + path: "~{{ postgresql_service_user }}/pgtab" + owner: "{{ postgresql_service_user }}" + group: "{{ postgresql_service_group }}" + mode: 0644 + create: yes + insertbefore: BOF + regexp: "^# pgclustername :.*$" + line: "# pgclustername : pgtabversion : pgrelease : pgport : pgdatabase : pgroot : pgbindir : [pgdata] : [pgwalarch] : [pgbackups]" + when: postgresql_service_user_pgsql_profile - - name: PostgreSQL | Create ~/pgtab Ansible warning | RHEL - lineinfile: - path: "~{{ postgresql_service_user }}/pgtab" - owner: "{{ postgresql_service_user }}" - group: "{{ postgresql_service_group }}" - mode: 0644 - insertbefore: BOF - regexp: "^# NOTICE: This file is managed by Ansible. Do not modify it.$" - line: "# NOTICE: This file is managed by Ansible. Do not modify it." - when: postgresql_service_user_pgsql_profile + - name: PostgreSQL | Create ~/pgtab Ansible warning | RHEL + lineinfile: + path: "~{{ postgresql_service_user }}/pgtab" + owner: "{{ postgresql_service_user }}" + group: "{{ postgresql_service_group }}" + mode: 0644 + insertbefore: BOF + regexp: "^# NOTICE: This file is managed by Ansible. Do not modify it.$" + line: "# NOTICE: This file is managed by Ansible. Do not modify it." + when: postgresql_service_user_pgsql_profile - - name: PostgreSQL | Add database to ~/pgtab | RHEL - lineinfile: - path: "~{{ postgresql_service_user }}/pgtab" - owner: "{{ postgresql_service_user }}" - group: "{{ postgresql_service_group }}" - mode: 0644 - regexp: "{{ postgresql_cluster_name }}:.*$" - line: "{{ postgresql_cluster_name }}:1:{{ postgresql_version }}:{{ postgresql_port }}:{{ postgresql_service_user }}:/var/lib/pgsql:/usr/pgsql-{{ postgresql_version }}/bin:{{ postgresql_data_directory }}:::" - when: postgresql_service_user_pgsql_profile + - name: PostgreSQL | Add database to ~/pgtab | RHEL + lineinfile: + path: "~{{ postgresql_service_user }}/pgtab" + owner: "{{ postgresql_service_user }}" + group: "{{ postgresql_service_group }}" + mode: 0644 + regexp: "{{ postgresql_cluster_name }}:.*$" + line: "{{ postgresql_cluster_name }}:1:{{ postgresql_version }}:{{ postgresql_port }}:{{ postgresql_service_user }}:/var/lib/pgsql:/usr/pgsql-{{ postgresql_version }}/bin:{{ postgresql_data_directory }}:::" + when: postgresql_service_user_pgsql_profile - - name: PostgreSQL | PGTune | RHEL - yum: - name: pgtune - state: present - environment: "{{ postgresql_env }}" - when: postgresql_pgtune + - name: PostgreSQL | PGTune | RHEL + yum: + name: pgtune + state: present + environment: "{{ postgresql_env }}" + when: postgresql_pgtune diff --git a/tasks/main.yml b/tasks/main.yml index 9eedb0616..aefdd5501 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -21,7 +21,7 @@ tags: [postgresql, postgresql-install] - import_tasks: install_rhel.yml - when: (ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf") and (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "OracleLinux") + when: (ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf") and (ansible_os_family == "RedHat" ) tags: [postgresql, postgresql-install] - import_tasks: install_fedora.yml diff --git a/vars/RedHat_9.yml b/vars/RedHat_9.yml new file mode 100644 index 000000000..49f177a29 --- /dev/null +++ b/vars/RedHat_9.yml @@ -0,0 +1,27 @@ +--- +# PostgreSQL vars for RedHat 8+ based distributions +# +# Using a different cluster name could cause problems with SELinux. +# See /usr/lib/systemd/system/postgresql-*.service +postgresql_cluster_name: "data" +postgresql_service_name: "postgresql-{{ postgresql_version }}" + +postgresql_varlib_directory_name: "pgsql" + +# Used to execute initdb +postgresql_bin_directory: "/usr/pgsql-{{postgresql_version}}/bin" + +postgresql_unix_socket_directories: + - "{{ postgresql_pid_directory }}" + - /tmp + +postgresql_fdw_mysql_packages: "mysql_fdw_{{ postgresql_version_terse }}" +postgresql_fdw_ogr_packages: "ogr_fdw{{ postgresql_version_terse }}" + +postgresql_packages: + - ca-certificates + - python3-psycopg2 + - python3-pycurl + - glibc-common + - epel-release + - python3-libselinux From 5e2cafafc99159538dd693b0f3ddcfe34da46f44 Mon Sep 17 00:00:00 2001 From: Florent THOMAS Date: Sun, 21 May 2023 18:26:17 +0200 Subject: [PATCH 2/7] postgis support matrix --- defaults/main.yml | 576 +++++++++++++++++++++++----------------------- 1 file changed, 293 insertions(+), 283 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 1404a8459..c40a4fa1d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,7 +2,7 @@ # Basic settings postgresql_version: 15 -postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}" # Short version of the postgresql_version, used in some path and filenames +postgresql_version_terse: "{{ postgresql_version | replace('.', '') }}" # Short version of the postgresql_version, used in some path and filenames postgresql_encoding: "UTF-8" postgresql_data_checksums: false postgresql_pwfile: "" @@ -40,13 +40,15 @@ postgresql_ext_install_contrib: no postgresql_ext_install_dev_headers: no postgresql_ext_install_postgis: no -# PostGIS +# PostGIS https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS postgresql_postgis_release_compatibility: 9.5: "3.0" 9.6: "3.1" 10: "3.1" 12: "3.1" 13: "3.1" + 14: "3.4" + 15: "3.4" postgresql_ext_postgis_version: "{{ postgresql_postgis_release_compatibility.get(postgresql_version) }}" postgresql_ext_postgis_version_terse: "{{ postgresql_ext_postgis_version | replace('.','') }}" @@ -77,10 +79,38 @@ postgresql_user_privileges: [] # pg_hba.conf postgresql_pg_hba_default: - - { type: local, database: all, user: all, address: "", method: "{{ postgresql_default_auth_method }}", comment: '"local" is for Unix domain socket connections only' } - - { type: host, database: all, user: all, address: "127.0.0.1/32", method: "{{ postgresql_default_auth_method_hosts }}", comment: "IPv4 local connections:" } - - { type: host, database: all, user: all, address: "::1/128", method: "{{ postgresql_default_auth_method_hosts }}", comment: "IPv6 local connections:" } - - { type: local, database: all, user: "{{ postgresql_admin_user }}", address: "", method: "peer map=root_as_{{ postgresql_admin_user }}", comment: "Local root Unix user, passwordless access" } + - { + type: local, + database: all, + user: all, + address: "", + method: "{{ postgresql_default_auth_method }}", + comment: '"local" is for Unix domain socket connections only', + } + - { + type: host, + database: all, + user: all, + address: "127.0.0.1/32", + method: "{{ postgresql_default_auth_method_hosts }}", + comment: "IPv4 local connections:", + } + - { + type: host, + database: all, + user: all, + address: "::1/128", + method: "{{ postgresql_default_auth_method_hosts }}", + comment: "IPv6 local connections:", + } + - { + type: local, + database: all, + user: "{{ postgresql_admin_user }}", + address: "", + method: "peer map=root_as_{{ postgresql_admin_user }}", + comment: "Local root Unix user, passwordless access", + } postgresql_pg_hba_md5_hosts: [] postgresql_pg_hba_passwd_hosts: [] @@ -125,15 +155,14 @@ postgresql_port: 5432 postgresql_max_connections: 100 postgresql_superuser_reserved_connections: 3 -postgresql_unix_socket_directory: "" # (<= 9.2) -postgresql_unix_socket_directories: # (>= 9.3) +postgresql_unix_socket_directory: "" # (<= 9.2) +postgresql_unix_socket_directories: # (>= 9.3) - "{{ postgresql_pid_directory }}" postgresql_unix_socket_group: "" postgresql_unix_socket_permissions: "0777" # begin with 0 to use octal notation -postgresql_bonjour: off # advertise server via Bonjour -postgresql_bonjour_name: "" # defaults to the computer name - +postgresql_bonjour: off # advertise server via Bonjour +postgresql_bonjour_name: "" # defaults to the computer name # - Security and Authentication - @@ -146,20 +175,20 @@ postgresql_ssl_ciphers: - "!aNULL" postgresql_ssl_prefer_server_ciphers: on postgresql_ssl_ecdh_curve: "prime256v1" -postgresql_ssl_min_protocol_version: "TLSv1.2" # (>= 12) -postgresql_ssl_max_protocol_version: "" # (>= 12) -postgresql_ssl_dh_params_file: "" # (>= 10) -postgresql_ssl_passphrase_command: "" # (>= 11) -postgresql_ssl_passphrase_command_supports_reload: off # (>= 11) -postgresql_ssl_renegotiation_limit: 512MB # amount of data between renegotiations -postgresql_ssl_cert_file: "/etc/ssl/certs/ssl-cert-snakeoil.pem" # (>= 9.2) -postgresql_ssl_key_file: "/etc/ssl/private/ssl-cert-snakeoil.key" # (>= 9.2) -postgresql_ssl_ca_file: "" # (>= 9.2) -postgresql_ssl_crl_file: "" # (>= 9.2) -postgresql_ssl_crl_dir: "" # (>= 14) +postgresql_ssl_min_protocol_version: "TLSv1.2" # (>= 12) +postgresql_ssl_max_protocol_version: "" # (>= 12) +postgresql_ssl_dh_params_file: "" # (>= 10) +postgresql_ssl_passphrase_command: "" # (>= 11) +postgresql_ssl_passphrase_command_supports_reload: off # (>= 11) +postgresql_ssl_renegotiation_limit: 512MB # amount of data between renegotiations +postgresql_ssl_cert_file: "/etc/ssl/certs/ssl-cert-snakeoil.pem" # (>= 9.2) +postgresql_ssl_key_file: "/etc/ssl/private/ssl-cert-snakeoil.key" # (>= 9.2) +postgresql_ssl_ca_file: "" # (>= 9.2) +postgresql_ssl_crl_file: "" # (>= 9.2) +postgresql_ssl_crl_dir: "" # (>= 14) postgresql_password_encryption: scram-sha-256 # (>=10.0 set to scram-sha-256 for best security) postgresql_db_user_namespace: off -postgresql_row_security: on # (>= 9.5) +postgresql_row_security: on # (>= 9.5) # Kerberos and GSSAPI postgresql_krb_server_keyfile: "" @@ -170,8 +199,8 @@ postgresql_krb_caseins_users: off postgresql_tcp_keepalives_idle: 0 postgresql_tcp_keepalives_interval: 0 postgresql_tcp_keepalives_count: 0 -postgresql_tcp_user_timeout: 0 # (>= 12) -postgresql_client_connection_check_interval: 0 # (>= 14) +postgresql_tcp_user_timeout: 0 # (>= 12) +postgresql_client_connection_check_interval: 0 # (>= 14) #------------------------------------------------------------------------------ # RESOURCE USAGE (except WAL) @@ -179,76 +208,74 @@ postgresql_client_connection_check_interval: 0 # (>= 14) # - Memory - -postgresql_shared_buffers: 128MB # min 128kB -postgresql_huge_pages: "try" # on, off, or try -postgresql_huge_page_size: 0 # (>= 14) -postgresql_temp_buffers: 8MB # min 800kB +postgresql_shared_buffers: 128MB # min 128kB +postgresql_huge_pages: "try" # on, off, or try +postgresql_huge_page_size: 0 # (>= 14) +postgresql_temp_buffers: 8MB # min 800kB # Caution: it is not advisable to set max_prepared_transactions nonzero unless # you actively intend to use prepared transactions. postgresql_max_prepared_transactions: 0 # zero disables the feature -postgresql_work_mem: 1MB # min 64kB -postgresql_hash_mem_multiplier: 1.0 # (>= 13) -postgresql_maintenance_work_mem: 16MB # min 1MB -postgresql_replacement_sort_tuples: 150000 # (>= 9.6) limits use of replacement selection sort -postgresql_autovacuum_work_mem: -1 # min 1MB, or -1 to use maintenance_work_mem -postgresql_logical_decoding_work_mem: 64MB # (>= 13) -postgresql_max_stack_depth: 2MB # min 100kB -postgresql_shared_memory_type: "mmap" # (>= 12) - -postgresql_dynamic_shared_memory_type: "posix" # the default is the first option - # supported by the operating system: - # posix - # sysv - # windows - # mmap - # use none to disable dynamic shared memory -postgresql_min_dynamic_shared_memory: 0MB # (>= 14) (change requires restart) +postgresql_work_mem: 1MB # min 64kB +postgresql_hash_mem_multiplier: 1.0 # (>= 13) +postgresql_maintenance_work_mem: 16MB # min 1MB +postgresql_replacement_sort_tuples: 150000 # (>= 9.6) limits use of replacement selection sort +postgresql_autovacuum_work_mem: -1 # min 1MB, or -1 to use maintenance_work_mem +postgresql_logical_decoding_work_mem: 64MB # (>= 13) +postgresql_max_stack_depth: 2MB # min 100kB +postgresql_shared_memory_type: "mmap" # (>= 12) + +postgresql_dynamic_shared_memory_type: + "posix" # the default is the first option + # supported by the operating system: + # posix + # sysv + # windows + # mmap + # use none to disable dynamic shared memory +postgresql_min_dynamic_shared_memory: 0MB # (>= 14) (change requires restart) # - Disk - # limits per-process temp file space in kB, or -1 for no limit (>= 9.2) postgresql_temp_file_limit: -1 - # - Kernel Resource Usage - -postgresql_max_files_per_process: 1000 # min 25 +postgresql_max_files_per_process: 1000 # min 25 postgresql_shared_preload_libraries: [] - # - Cost-Based Vacuum Delay - -postgresql_vacuum_cost_delay: 0 # 0-100 milliseconds -postgresql_vacuum_cost_page_hit: 1 # 0-10000 credits -postgresql_vacuum_cost_page_miss: 10 # 0-10000 credits -postgresql_vacuum_cost_page_dirty: 20 # 0-10000 credits -postgresql_vacuum_cost_limit: 200 # 1-10000 credits - +postgresql_vacuum_cost_delay: 0 # 0-100 milliseconds +postgresql_vacuum_cost_page_hit: 1 # 0-10000 credits +postgresql_vacuum_cost_page_miss: 10 # 0-10000 credits +postgresql_vacuum_cost_page_dirty: 20 # 0-10000 credits +postgresql_vacuum_cost_limit: 200 # 1-10000 credits # - Background Writer - -postgresql_bgwriter_delay: 200ms # 10-10000ms between rounds -postgresql_bgwriter_lru_maxpages: 100 # 0-1000 max buffers written/round -postgresql_bgwriter_lru_multiplier: 2.0 # 0-10.0 multiplier on buffers scanned/round -postgresql_bgwriter_flush_after: 0 # (>= 9.6) 0 disables, - # default is 512kB on linux, 0 otherwise - +postgresql_bgwriter_delay: 200ms # 10-10000ms between rounds +postgresql_bgwriter_lru_maxpages: 100 # 0-1000 max buffers written/round +postgresql_bgwriter_lru_multiplier: 2.0 # 0-10.0 multiplier on buffers scanned/round +postgresql_bgwriter_flush_after: + 0 # (>= 9.6) 0 disables, + # default is 512kB on linux, 0 otherwise # - Asynchronous Behavior - -postgresql_effective_io_concurrency: 1 # 1-1000; 0 disables prefetching -postgresql_maintenance_io_concurrency: 10 # (>= 13) -postgresql_max_worker_processes: 8 # (change requires restart) -postgresql_max_parallel_maintenance_workers: 2 # (>= 11) taken from max_parallel_workers -postgresql_max_parallel_workers_per_gather: 0 # (>= 9.6) taken from max_worker_processes -postgresql_parallel_leader_participation: on # (>= 11) -postgresql_max_parallel_workers: 8 # (>= 10) -postgresql_old_snapshot_threshold: -1 # (>= 9.6) 1min-60d; -1 disables; 0 is immediate - # (change requires restart) -postgresql_backend_flush_after: 0 # (>= 9.6) 0 disables, default is 0 - +postgresql_effective_io_concurrency: 1 # 1-1000; 0 disables prefetching +postgresql_maintenance_io_concurrency: 10 # (>= 13) +postgresql_max_worker_processes: 8 # (change requires restart) +postgresql_max_parallel_maintenance_workers: 2 # (>= 11) taken from max_parallel_workers +postgresql_max_parallel_workers_per_gather: 0 # (>= 9.6) taken from max_worker_processes +postgresql_parallel_leader_participation: on # (>= 11) +postgresql_max_parallel_workers: 8 # (>= 10) +postgresql_old_snapshot_threshold: + -1 # (>= 9.6) 1min-60d; -1 disables; 0 is immediate + # (change requires restart) +postgresql_backend_flush_after: 0 # (>= 9.6) 0 disables, default is 0 #------------------------------------------------------------------------------ # WRITE AHEAD LOG @@ -256,10 +283,11 @@ postgresql_backend_flush_after: 0 # (>= 9.6) 0 disables, default # - Settings - -postgresql_wal_level: "replica" # minimal, archive (<= 9.5), hot_standby (<= 9.5), replica (>= 9.6), or logical -postgresql_fsync: on # flush data to disk for crash safety - # (turning this off can cause - # unrecoverable data corruption) +postgresql_wal_level: "replica" # minimal, archive (<= 9.5), hot_standby (<= 9.5), replica (>= 9.6), or logical +postgresql_fsync: + on # flush data to disk for crash safety + # (turning this off can cause + # unrecoverable data corruption) # Synchronization level: # - off @@ -279,40 +307,40 @@ postgresql_wal_sync_method: "fsync" # recover from partial page writes postgresql_full_page_writes: on -postgresql_wal_compression: off # (>= 9.5) -postgresql_wal_log_hints: off # also do full page writes of non-critical updates -postgresql_wal_init_zero: on # zero-fill new WAL files -postgresql_wal_recycle: on # recycle WAL files - -postgresql_wal_buffers: -1 # min 32kB, -1 sets based on shared_buffers -postgresql_wal_writer_delay: 200ms # 1-10000 milliseconds -postgresql_wal_writer_flush_after: 1MB # (>= 9.6) 0 disables -postgresql_wal_skip_threshold: 2MB # (>= 13) -postgresql_commit_delay: 0 # range 0-100000, in microseconds -postgresql_commit_siblings: 5 # range 1-1000 - +postgresql_wal_compression: off # (>= 9.5) +postgresql_wal_log_hints: off # also do full page writes of non-critical updates +postgresql_wal_init_zero: on # zero-fill new WAL files +postgresql_wal_recycle: on # recycle WAL files + +postgresql_wal_buffers: -1 # min 32kB, -1 sets based on shared_buffers +postgresql_wal_writer_delay: 200ms # 1-10000 milliseconds +postgresql_wal_writer_flush_after: 1MB # (>= 9.6) 0 disables +postgresql_wal_skip_threshold: 2MB # (>= 13) +postgresql_commit_delay: 0 # range 0-100000, in microseconds +postgresql_commit_siblings: 5 # range 1-1000 # - Checkpoints - -postgresql_max_wal_size: 1GB # (>= 9.5) -postgresql_min_wal_size: 80MB # (>= 9.5) -postgresql_checkpoint_flush_after: 0 # (>= 9.6) 0 disables, - # default is 256kB on linux, 0 otherwise -postgresql_checkpoint_timeout: 5min # range 30s-1d -postgresql_checkpoint_completion_target: 0.5 # checkpoint target duration, 0.0 - 1.0 -postgresql_checkpoint_warning: 30s # 0 disables +postgresql_max_wal_size: 1GB # (>= 9.5) +postgresql_min_wal_size: 80MB # (>= 9.5) +postgresql_checkpoint_flush_after: + 0 # (>= 9.6) 0 disables, + # default is 256kB on linux, 0 otherwise +postgresql_checkpoint_timeout: 5min # range 30s-1d +postgresql_checkpoint_completion_target: 0.5 # checkpoint target duration, 0.0 - 1.0 +postgresql_checkpoint_warning: 30s # 0 disables # - Prefetching during recovery - -postgresql_recovery_prefetch: try # (>= 15) -postgresql_wal_decode_buffer_size: 512kB # (>= 15) +postgresql_recovery_prefetch: try # (>= 15) +postgresql_wal_decode_buffer_size: 512kB # (>= 15) # - Archiving - # allows archiving to be done postgresql_archive_mode: "off" -postgresql_archive_library: "" # (>= 15) +postgresql_archive_library: "" # (>= 15) # Command to use to archive a logfile segment. # Placeholders: %p = path of file to archive @@ -325,22 +353,21 @@ postgresql_archive_timeout: 0 # - Archive Recovery - -postgresql_restore_command: "" # (>= 12) -postgresql_archive_cleanup_command: "" # (>= 12) -postgresql_recovery_end_command: "" # (>= 12) -postgresql_recovery_target: "" # (>= 12) -postgresql_recovery_target_name: "" # (>= 12) -postgresql_recovery_target_time: "" # (>= 12) -postgresql_recovery_target_xid: "" # (>= 12) -postgresql_recovery_target_lsn: "" # (>= 12) -postgresql_recovery_target_inclusive: "" # (>= 12) -postgresql_recovery_target_timeline: "latest" # (>= 12) -postgresql_recovery_target_action: "pause" # (>= 12) -postgresql_primary_conninfo: "" # (>= 12) -postgresql_primary_slot_name: "" # (>= 12) -postgresql_promote_trigger_file: "" # (>= 12) -postgresql_recovery_min_apply_delay: 0 # (>= 12) - +postgresql_restore_command: "" # (>= 12) +postgresql_archive_cleanup_command: "" # (>= 12) +postgresql_recovery_end_command: "" # (>= 12) +postgresql_recovery_target: "" # (>= 12) +postgresql_recovery_target_name: "" # (>= 12) +postgresql_recovery_target_time: "" # (>= 12) +postgresql_recovery_target_xid: "" # (>= 12) +postgresql_recovery_target_lsn: "" # (>= 12) +postgresql_recovery_target_inclusive: "" # (>= 12) +postgresql_recovery_target_timeline: "latest" # (>= 12) +postgresql_recovery_target_action: "pause" # (>= 12) +postgresql_primary_conninfo: "" # (>= 12) +postgresql_primary_slot_name: "" # (>= 12) +postgresql_promote_trigger_file: "" # (>= 12) +postgresql_recovery_min_apply_delay: 0 # (>= 12) #------------------------------------------------------------------------------ # REPLICATION @@ -352,14 +379,14 @@ postgresql_recovery_min_apply_delay: 0 # (>= 12) # max number of walsender processes postgresql_max_wal_senders: 10 -postgresql_wal_sender_delay: 1s # walsender cycle time, 1-10000 milliseconds (<= 9.1) +postgresql_wal_sender_delay: 1s # walsender cycle time, 1-10000 milliseconds (<= 9.1) -postgresql_wal_keep_segments: 0 # in logfile segments, 16MB each; 0 disables -postgresql_wal_keep_size: 0 # (>= 13) -postgresql_max_slot_wal_keep_size: -1 # (>= 13) +postgresql_wal_keep_segments: 0 # in logfile segments, 16MB each; 0 disables +postgresql_wal_keep_size: 0 # (>= 13) +postgresql_max_slot_wal_keep_size: -1 # (>= 13) postgresql_replication_timeout: 60s # in milliseconds; 0 disables (<= 9.2) -postgresql_wal_sender_timeout: 60s # in milliseconds; 0 disables (>= 9.3) +postgresql_wal_sender_timeout: 60s # in milliseconds; 0 disables (>= 9.3) postgresql_max_replication_slots: 0 # max number of replication slots postgresql_track_commit_timestamp: off # (>= 9.5) @@ -377,7 +404,6 @@ postgresql_synchronous_standby_names: [] # '*' means 'all' # number of xacts by which cleanup is delayed postgresql_vacuum_defer_cleanup_age: 0 - # - Standby Servers - # "on" allows queries during recovery @@ -386,7 +412,7 @@ postgresql_hot_standby: off postgresql_max_standby_archive_delay: 30s # -1 allows indefinite delay # max delay before canceling queries when reading streaming WAL; postgresql_max_standby_streaming_delay: 30s # -1 allows indefinite delay -postgresql_wal_receiver_create_temp_slot: off # (>= 13) +postgresql_wal_receiver_create_temp_slot: off # (>= 13) # send replies at least this often postgresql_wal_receiver_status_interval: 10s # 0 disables # send info from standby to prevent query conflicts @@ -400,80 +426,77 @@ postgresql_wal_retrieve_retry_interval: 5s # (>= 9.5) # These settings are ignored on a publisher. -postgresql_max_logical_replication_workers: 4 # (>= 10) taken from max_worker_processes - # (change requires restart) +postgresql_max_logical_replication_workers: + 4 # (>= 10) taken from max_worker_processes + # (change requires restart) postgresql_max_sync_workers_per_subscription: 2 # (>= 10) taken from max_logical_replication_workers - #------------------------------------------------------------------------------ # QUERY TUNING #------------------------------------------------------------------------------ # - Planner Method Configuration - -postgresql_enable_async_append: on # (>= 14) -postgresql_enable_bitmapscan: on -postgresql_enable_gathermerge: on # (>= 14) -postgresql_enable_hashagg: on -postgresql_enable_hashjoin: on -postgresql_enable_indexscan: on -postgresql_enable_indexonlyscan: on -postgresql_enable_material: on -postgresql_enable_memoize: on # (>= 14) -postgresql_enable_mergejoin: on -postgresql_enable_nestloop: on -postgresql_enable_parallel_append: on # (>= 11) -postgresql_enable_seqscan: on -postgresql_enable_sort: on -postgresql_enable_incremental_sort: on # (>= 13) -postgresql_enable_tidscan: on -postgresql_enable_partitionwise_join: off # (>= 11) -postgresql_enable_partitionwise_aggregate: off # (>= 11) -postgresql_enable_parallel_hash: on # (>= 11) -postgresql_enable_partition_pruning: on # (>= 11) - +postgresql_enable_async_append: on # (>= 14) +postgresql_enable_bitmapscan: on +postgresql_enable_gathermerge: on # (>= 14) +postgresql_enable_hashagg: on +postgresql_enable_hashjoin: on +postgresql_enable_indexscan: on +postgresql_enable_indexonlyscan: on +postgresql_enable_material: on +postgresql_enable_memoize: on # (>= 14) +postgresql_enable_mergejoin: on +postgresql_enable_nestloop: on +postgresql_enable_parallel_append: on # (>= 11) +postgresql_enable_seqscan: on +postgresql_enable_sort: on +postgresql_enable_incremental_sort: on # (>= 13) +postgresql_enable_tidscan: on +postgresql_enable_partitionwise_join: off # (>= 11) +postgresql_enable_partitionwise_aggregate: off # (>= 11) +postgresql_enable_parallel_hash: on # (>= 11) +postgresql_enable_partition_pruning: on # (>= 11) # - Planner Cost Constants - -postgresql_seq_page_cost: 1.0 # measured on an arbitrary scale -postgresql_random_page_cost: 4.0 # same scale as above -postgresql_cpu_tuple_cost: 0.01 # same scale as above -postgresql_cpu_index_tuple_cost: 0.005 # same scale as above -postgresql_cpu_operator_cost: 0.0025 # same scale as above -postgresql_parallel_tuple_cost: 0.1 # same scale as above (>= 9.6) -postgresql_parallel_setup_cost: 1000.0 # same scale as above (>= 9.6) -postgresql_jit_above_cost: 100000 # perform JIT compilation if available -postgresql_jit_inline_above_cost: 500000 # inline small functions if query is -postgresql_jit_optimize_above_cost: 500000 # use expensive JIT optimizations if - -postgresql_min_parallel_relation_size: 8MB # (= 9.6) replaced by below two parameters in 10 -postgresql_min_parallel_table_scan_size: 8MB # (>= 10) +postgresql_seq_page_cost: 1.0 # measured on an arbitrary scale +postgresql_random_page_cost: 4.0 # same scale as above +postgresql_cpu_tuple_cost: 0.01 # same scale as above +postgresql_cpu_index_tuple_cost: 0.005 # same scale as above +postgresql_cpu_operator_cost: 0.0025 # same scale as above +postgresql_parallel_tuple_cost: 0.1 # same scale as above (>= 9.6) +postgresql_parallel_setup_cost: 1000.0 # same scale as above (>= 9.6) +postgresql_jit_above_cost: 100000 # perform JIT compilation if available +postgresql_jit_inline_above_cost: 500000 # inline small functions if query is +postgresql_jit_optimize_above_cost: 500000 # use expensive JIT optimizations if + +postgresql_min_parallel_relation_size: 8MB # (= 9.6) replaced by below two parameters in 10 +postgresql_min_parallel_table_scan_size: 8MB # (>= 10) postgresql_min_parallel_index_scan_size: 512kB # (>= 10) -postgresql_effective_cache_size: 128MB - +postgresql_effective_cache_size: 128MB # - Genetic Query Optimizer - -postgresql_geqo: on -postgresql_geqo_threshold: 12 -postgresql_geqo_effort: 5 # range 1-10 -postgresql_geqo_pool_size: 0 # selects default based on effort -postgresql_geqo_generations: 0 # selects default based on effort -postgresql_geqo_selection_bias: 2.0 # range 1.5-2.0 -postgresql_geqo_seed: 0.0 # range 0.0-1.0 - +postgresql_geqo: on +postgresql_geqo_threshold: 12 +postgresql_geqo_effort: 5 # range 1-10 +postgresql_geqo_pool_size: 0 # selects default based on effort +postgresql_geqo_generations: 0 # selects default based on effort +postgresql_geqo_selection_bias: 2.0 # range 1.5-2.0 +postgresql_geqo_seed: 0.0 # range 0.0-1.0 # - Other Planner Options - -postgresql_default_statistics_target: 100 # range 1-10000 -postgresql_constraint_exclusion: "partition" # on, off, or partition -postgresql_cursor_tuple_fraction: 0.1 # range 0.0-1.0 -postgresql_from_collapse_limit: 8 -postgresql_join_collapse_limit: 8 # 1 disables collapsing of explicit -postgresql_force_parallel_mode: off # on, off, regress (>= 9.6 <= 13) -postgresql_jit: on # (>= 11: off, 12: on) -postgresql_plan_cache_mode: "auto" # (>= 12) -postgresql_recursive_worktable_factor: 10.0 # (>= 15) range 0.001-1000000 +postgresql_default_statistics_target: 100 # range 1-10000 +postgresql_constraint_exclusion: "partition" # on, off, or partition +postgresql_cursor_tuple_fraction: 0.1 # range 0.0-1.0 +postgresql_from_collapse_limit: 8 +postgresql_join_collapse_limit: 8 # 1 disables collapsing of explicit +postgresql_force_parallel_mode: off # on, off, regress (>= 9.6 <= 13) +postgresql_jit: on # (>= 11: off, 12: on) +postgresql_plan_cache_mode: "auto" # (>= 12) +postgresql_recursive_worktable_factor: 10.0 # (>= 15) range 0.001-1000000 #------------------------------------------------------------------------------ # ERROR REPORTING AND LOGGING @@ -483,37 +506,36 @@ postgresql_recursive_worktable_factor: 10.0 # (>= 15) range 0.001-100000 # Valid values are combinations of stderr, csvlog, syslog, and eventlog. # depending on platform. Csvlog requires logging_collector to be on. -postgresql_log_destination: "stderr" +postgresql_log_destination: "stderr" # Enable capturing of stderr and csvlog into log files. # Required to be on for csvlogs. -postgresql_logging_collector: off +postgresql_logging_collector: off # These are only used if logging_collector is on: # Directory where log files are written, can be absolute or relative to PGDATA -postgresql_log_directory: "pg_log" +postgresql_log_directory: "pg_log" # Log file name pattern, can include strftime() escapes -postgresql_log_filename: "postgresql-%Y-%m-%d_%H%M%S.log" -postgresql_log_file_mode: "0600" # begin with 0 to use octal notation +postgresql_log_filename: "postgresql-%Y-%m-%d_%H%M%S.log" +postgresql_log_file_mode: "0600" # begin with 0 to use octal notation # If on, an existing log file with the same name as the new log file will be # truncated rather than appended to. But such truncation only occurs on # time-driven rotation, not on restarts or size-driven rotation. Default is # off, meaning append to existing files in all cases. -postgresql_log_truncate_on_rotation: off +postgresql_log_truncate_on_rotation: off # Automatic rotation of logfiles will happen after that time. -postgresql_log_rotation_age: 1d +postgresql_log_rotation_age: 1d # Automatic rotation of logfiles will happen after that much log output. -postgresql_log_rotation_size: 10MB +postgresql_log_rotation_size: 10MB # These are relevant when logging to syslog: -postgresql_syslog_facility: "LOCAL0" -postgresql_syslog_ident: "postgres" -postgresql_syslog_sequence_numbers: on # (>= 9.6) -postgresql_syslog_split_messages: on # (>= 9.6) +postgresql_syslog_facility: "LOCAL0" +postgresql_syslog_ident: "postgres" +postgresql_syslog_sequence_numbers: on # (>= 9.6) +postgresql_syslog_split_messages: on # (>= 9.6) # This is only relevant when logging to eventlog (win32) (>= 9.2): -postgresql_event_source: "PostgreSQL" - +postgresql_event_source: "PostgreSQL" # - When to Log - @@ -562,24 +584,23 @@ postgresql_log_min_error_statement: "error" # -1 is disabled, 0 logs all statements and their durations, > 0 logs only # statements running at least this number of milliseconds postgresql_log_min_duration_statement: -1 -postgresql_log_min_duration_sample: -1 # (>= 13) -postgresql_log_statement_sample_rate: 1.0 # (>= 13) -postgresql_log_transaction_sample_rate: 0.0 # (>= 12) -postgresql_log_startup_progress_interval: 10s # (>= 15) - +postgresql_log_min_duration_sample: -1 # (>= 13) +postgresql_log_statement_sample_rate: 1.0 # (>= 13) +postgresql_log_transaction_sample_rate: 0.0 # (>= 12) +postgresql_log_startup_progress_interval: 10s # (>= 15) # - What to Log - -postgresql_debug_print_parse: off +postgresql_debug_print_parse: off postgresql_debug_print_rewritten: off -postgresql_debug_print_plan: off -postgresql_debug_pretty_print: on -postgresql_log_checkpoints: off -postgresql_log_connections: off -postgresql_log_disconnections: off -postgresql_log_duration: off -postgresql_log_error_verbosity: "default" # terse, default, or verbose messages -postgresql_log_hostname: off +postgresql_debug_print_plan: off +postgresql_debug_pretty_print: on +postgresql_log_checkpoints: off +postgresql_log_connections: off +postgresql_log_disconnections: off +postgresql_log_duration: off +postgresql_log_error_verbosity: "default" # terse, default, or verbose messages +postgresql_log_hostname: off # Special values: # %a = application name @@ -609,16 +630,14 @@ postgresql_log_line_prefix: "%t " # log lock waits >= deadlock_timeout postgresql_log_lock_waits: off -postgresql_log_recovery_conflict_waits: off # (>= 14) -postgresql_log_parameter_max_length: -1 # (>= 13) -postgresql_log_parameter_max_length_on_error: 0 # (>= 13) -postgresql_log_statement: "none" # none, ddl, mod, all +postgresql_log_recovery_conflict_waits: off # (>= 14) +postgresql_log_parameter_max_length: -1 # (>= 13) +postgresql_log_parameter_max_length_on_error: 0 # (>= 13) +postgresql_log_statement: "none" # none, ddl, mod, all postgresql_log_replication_commands: off # log temporary files equal or larger postgresql_log_temp_files: -1 -postgresql_log_timezone: "UTC" - - +postgresql_log_timezone: "UTC" #------------------------------------------------------------------------------ # RUNTIME STATISTICS @@ -626,26 +645,24 @@ postgresql_log_timezone: "UTC" # - Query/Index Statistics Collector - -postgresql_track_activities: on -postgresql_track_counts: on -postgresql_track_io_timing: off # (>= 9.2) -postgresql_track_wal_io_timing: off # (>= 14) -postgresql_track_functions: "none" # none, pl, all -postgresql_stats_fetch_consistency: cache # (>= 15) +postgresql_track_activities: on +postgresql_track_counts: on +postgresql_track_io_timing: off # (>= 9.2) +postgresql_track_wal_io_timing: off # (>= 14) +postgresql_track_functions: "none" # none, pl, all +postgresql_stats_fetch_consistency: cache # (>= 15) postgresql_track_activity_query_size: 1024 -postgresql_update_process_title: on -postgresql_stats_temp_directory: "pg_stat_tmp" # (<= 14) - +postgresql_update_process_title: on +postgresql_stats_temp_directory: "pg_stat_tmp" # (<= 14) # - Statistics Monitoring - -postgresql_compute_query_id: auto # (>= 14) auto, on, off -postgresql_log_parser_stats: off -postgresql_log_planner_stats: off -postgresql_log_executor_stats: off +postgresql_compute_query_id: auto # (>= 14) auto, on, off +postgresql_log_parser_stats: off +postgresql_log_planner_stats: off +postgresql_log_executor_stats: off postgresql_log_statement_stats: off - #------------------------------------------------------------------------------ # AUTOVACUUM PARAMETERS #------------------------------------------------------------------------------ @@ -661,12 +678,12 @@ postgresql_autovacuum_max_workers: 3 postgresql_autovacuum_naptime: 1min # min number of row updates before vacuum postgresql_autovacuum_vacuum_threshold: 50 -postgresql_autovacuum_vacuum_insert_threshold: 1000 # (>= 13) +postgresql_autovacuum_vacuum_insert_threshold: 1000 # (>= 13) # min number of row updates before analyze postgresql_autovacuum_analyze_threshold: 50 # fraction of table size before vacuum postgresql_autovacuum_vacuum_scale_factor: 0.2 -postgresql_autovacuum_vacuum_insert_scale_factor: 0.2 # (>= 13) +postgresql_autovacuum_vacuum_insert_scale_factor: 0.2 # (>= 13) # fraction of table size before analyze postgresql_autovacuum_analyze_scale_factor: 0.1 # maximum XID age before forced vacuum @@ -674,11 +691,10 @@ postgresql_autovacuum_freeze_max_age: 200000000 # maximum Multixact age before forced vacuum (>= 9.3) postgresql_autovacuum_multixact_freeze_max_age: 400000000 # default vacuum cost delay for autovacuum, in milliseconds -postgresql_autovacuum_vacuum_cost_delay: 2ms # (<= 11: 20ms, >=12 2ms) +postgresql_autovacuum_vacuum_cost_delay: 2ms # (<= 11: 20ms, >=12 2ms) # default vacuum cost limit for autovacuum, postgresql_autovacuum_vacuum_cost_limit: -1 - #------------------------------------------------------------------------------ # CLIENT CONNECTION DEFAULTS #------------------------------------------------------------------------------ @@ -694,38 +710,37 @@ postgresql_temp_tablespaces: [] # a list of tablespace names postgresql_default_table_access_method: "heap" postgresql_tablespaces_dirs: [] # a list of directories for tablespaces to be created -postgresql_check_function_bodies: on -postgresql_default_transaction_isolation: "read committed" -postgresql_default_transaction_read_only: off +postgresql_check_function_bodies: on +postgresql_default_transaction_isolation: "read committed" +postgresql_default_transaction_read_only: off postgresql_default_transaction_deferrable: off -postgresql_session_replication_role: "origin" - -postgresql_statement_timeout: 0 # in milliseconds, 0 is disabled -postgresql_lock_timeout: 0 # in milliseconds, 0 is disabled (>= 9.3) -postgresql_idle_in_transaction_session_timeout: 0 # in milliseconds, 0 is disabled (>= 9.6) -postgresql_idle_session_timeout: 0 # in milliseconds, 0 is disabled (>= 14) -postgresql_vacuum_freeze_min_age: 50000000 -postgresql_vacuum_freeze_table_age: 150000000 -postgresql_vacuum_cleanup_index_scale_factor: 0.1 # (>= 11 <= 13) -postgresql_vacuum_multixact_freeze_min_age: 5000000 # (>= 9.3) -postgresql_vacuum_multixact_failsafe_age: 1600000000 # (>= 14) -postgresql_vacuum_failsafe_age: 1600000000 # (>= 14) -postgresql_vacuum_multixact_freeze_table_age: 150000000 # (>= 9.3) - -postgresql_bytea_output: "hex" # hex, escape -postgresql_xmlbinary: "base64" -postgresql_xmloption: "content" -postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2) -postgresql_gin_pending_list_limit: 4MB # (>= 9.5) - +postgresql_session_replication_role: "origin" + +postgresql_statement_timeout: 0 # in milliseconds, 0 is disabled +postgresql_lock_timeout: 0 # in milliseconds, 0 is disabled (>= 9.3) +postgresql_idle_in_transaction_session_timeout: 0 # in milliseconds, 0 is disabled (>= 9.6) +postgresql_idle_session_timeout: 0 # in milliseconds, 0 is disabled (>= 14) +postgresql_vacuum_freeze_min_age: 50000000 +postgresql_vacuum_freeze_table_age: 150000000 +postgresql_vacuum_cleanup_index_scale_factor: 0.1 # (>= 11 <= 13) +postgresql_vacuum_multixact_freeze_min_age: 5000000 # (>= 9.3) +postgresql_vacuum_multixact_failsafe_age: 1600000000 # (>= 14) +postgresql_vacuum_failsafe_age: 1600000000 # (>= 14) +postgresql_vacuum_multixact_freeze_table_age: 150000000 # (>= 9.3) + +postgresql_bytea_output: "hex" # hex, escape +postgresql_xmlbinary: "base64" +postgresql_xmloption: "content" +postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2) +postgresql_gin_pending_list_limit: 4MB # (>= 9.5) # - Locale and Formatting - postgresql_datestyle: - "iso" - "mdy" -postgresql_intervalstyle: "postgres" -postgresql_timezone: "UTC" +postgresql_intervalstyle: "postgres" +postgresql_timezone: "UTC" # Select the set of available time zone abbreviations. Currently, there are: # Default @@ -734,9 +749,10 @@ postgresql_timezone: "UTC" # You can create your own file in `share/timezonesets/`. postgresql_timezone_abbreviations: "Default" -postgresql_extra_float_digits: 0 # min -15, max 3 -postgresql_client_encoding: false # actually defaults to database encoding - # 'sql_ascii', 'UTF8', ... +postgresql_extra_float_digits: 0 # min -15, max 3 +postgresql_client_encoding: + false # actually defaults to database encoding + # 'sql_ascii', 'UTF8', ... # These settings are initialized by initdb, but they can be changed. @@ -756,24 +772,23 @@ postgresql_local_preload_libraries: [] postgresql_session_preload_libraries: [] postgresql_jit_provider: "llvmjit" - #------------------------------------------------------------------------------ # LOCK MANAGEMENT #------------------------------------------------------------------------------ postgresql_deadlock_timeout: 1s -postgresql_max_locks_per_transaction: 64 # min 10 +postgresql_max_locks_per_transaction: 64 # min 10 # Note: Each lock table slot uses ~270 bytes of shared memory, and there are # max_locks_per_transaction * (max_connections + max_prepared_transactions) # lock table slots. -postgresql_max_pred_locks_per_transaction: 64 # min 10 - -postgresql_max_pred_locks_per_relation: -2 # (>= 10) negative values mean - # (max_pred_locks_per_transaction - # / -max_pred_locks_per_relation) - 1 -postgresql_max_pred_locks_per_page: 2 # (>= 10) min 0 +postgresql_max_pred_locks_per_transaction: 64 # min 10 +postgresql_max_pred_locks_per_relation: + -2 # (>= 10) negative values mean + # (max_pred_locks_per_transaction + # / -max_pred_locks_per_relation) - 1 +postgresql_max_pred_locks_per_page: 2 # (>= 10) min 0 #------------------------------------------------------------------------------ # VERSION/PLATFORM COMPATIBILITY @@ -781,22 +796,20 @@ postgresql_max_pred_locks_per_page: 2 # (>= 10) min 0 # - Previous PostgreSQL Versions - -postgresql_array_nulls: on -postgresql_backslash_quote: "safe_encoding" # on, off, or safe_encoding -postgresql_default_with_oids: off -postgresql_escape_string_warning: on -postgresql_lo_compat_privileges: off +postgresql_array_nulls: on +postgresql_backslash_quote: "safe_encoding" # on, off, or safe_encoding +postgresql_default_with_oids: off +postgresql_escape_string_warning: on +postgresql_lo_compat_privileges: off postgresql_operator_precedence_warning: off # (<= 13) -postgresql_quote_all_identifiers: off -postgresql_sql_inheritance: on +postgresql_quote_all_identifiers: off +postgresql_sql_inheritance: on postgresql_standard_conforming_strings: on -postgresql_synchronize_seqscans: on - +postgresql_synchronize_seqscans: on # - Other Platforms and Clients - -postgresql_transform_null_equals: off - +postgresql_transform_null_equals: off #------------------------------------------------------------------------------ # ERROR HANDLING @@ -810,19 +823,17 @@ postgresql_restart_after_crash: on postgresql_data_sync_retry: off postgresql_recovery_init_sync_method: fsync #(>= 14) fsync, syncfs (Linux 5.8+) - #------------------------------------------------------------------------------ # CONFIG FILE INCLUDES #------------------------------------------------------------------------------ # include files ending in '.conf' from # directory 'conf.d' -postgresql_include_dir: "conf.d" +postgresql_include_dir: "conf.d" # include file only if it exists -postgresql_include_if_exists: false +postgresql_include_if_exists: false # include file -postgresql_include: false - +postgresql_include: false #------------------------------------------------------------------------------ # PGTUNE @@ -836,7 +847,6 @@ postgresql_pgtune_type: "Mixed" # Maximum number of expected connections, if "no", default based on db type postgresql_pgtune_connections: no - #------------------------------------------------------------------------------ # INSTALL/REPO #------------------------------------------------------------------------------ From 03a3601f41ab2d541867e969a54252cae1d6120b Mon Sep 17 00:00:00 2001 From: Florent THOMAS Date: Mon, 29 May 2023 13:32:59 +0200 Subject: [PATCH 3/7] ADD: Allow to deal with custom --- defaults/main.yml | 5 ++++- tasks/users.yml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c40a4fa1d..eab3f219e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -78,7 +78,8 @@ postgresql_database_schemas: [] postgresql_user_privileges: [] # pg_hba.conf -postgresql_pg_hba_default: +postgresql_custom_pg_hba_default: [] +_postgresql_pg_hba_default: - { type: local, database: all, @@ -112,6 +113,8 @@ postgresql_pg_hba_default: comment: "Local root Unix user, passwordless access", } +postgresql_pg_hba_default: "{{ _postgresql_pg_hba_default + postgresql_custom_pg_hba_default }}" + postgresql_pg_hba_md5_hosts: [] postgresql_pg_hba_passwd_hosts: [] postgresql_pg_hba_trust_hosts: [] diff --git a/tasks/users.yml b/tasks/users.yml index dafe16cb6..867e735a9 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -13,8 +13,8 @@ port: "{{postgresql_port}}" state: "{{ item.state | default('present') }}" login_user: "{{postgresql_admin_user}}" - no_log: true - become: yes + # no_log: true + become: true become_user: "{{postgresql_admin_user}}" with_items: "{{postgresql_users}}" when: postgresql_users|length > 0 From 9f38cc7982ad71e26611c02b1931d7bfcdc97edd Mon Sep 17 00:00:00 2001 From: Florent THOMAS Date: Sat, 22 Jul 2023 12:00:27 +0200 Subject: [PATCH 4/7] better python version identification --- defaults/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index eab3f219e..677022dcb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -878,4 +878,5 @@ postgresql_dnf_repository_gpgkey: "{{ postgresql_yum_repository_gpgkey }}" postgresql_apt_py3_dependencies: ["python3-psycopg2", "locales"] postgresql_apt_py2_dependencies: ["python-psycopg2", "python-pycurl", "locales"] -postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if 'python3' in ansible_python_interpreter|default('') else postgresql_apt_py2_dependencies }}" +# postgresql_python_version: +postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if 'python3' in ansible_python['executable']|default('') else postgresql_apt_py2_dependencies }}" From 5731e4df5c5342cecc8dccd4165cdff63242ec5f Mon Sep 17 00:00:00 2001 From: Florent THOMAS Date: Sat, 22 Jul 2023 14:09:47 +0200 Subject: [PATCH 5/7] Simplier gis version --- defaults/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 677022dcb..722f61534 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -48,13 +48,20 @@ postgresql_postgis_release_compatibility: 12: "3.1" 13: "3.1" 14: "3.4" - 15: "3.4" + 15: "3*" postgresql_ext_postgis_version: "{{ postgresql_postgis_release_compatibility.get(postgresql_version) }}" postgresql_ext_postgis_version_terse: "{{ postgresql_ext_postgis_version | replace('.','') }}" +_libgeos_package_name: + default: + default: "libgeos-c1" + Debian: + default: "libgeos-c1" + 12: "libgeos-c1v5" + postgresql_ext_postgis_deps: - - libgeos-c1 + - "{{ _libgeos_package_name[ansible_os_family][ansible_distribution_major_version | int] }}" - "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}" - "postgresql-{{ postgresql_version }}-postgis-scripts" From 558faf6c279441860dfab27ed057df32313ee249 Mon Sep 17 00:00:00 2001 From: Florent THOMAS Date: Wed, 27 Dec 2023 09:47:55 +0100 Subject: [PATCH 6/7] [ADD]bullseye support for postgis [IMP]better default values for defensive --- defaults/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 722f61534..64a82e7bf 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -58,10 +58,11 @@ _libgeos_package_name: default: "libgeos-c1" Debian: default: "libgeos-c1" + 11: "libgeos-c1v5" 12: "libgeos-c1v5" postgresql_ext_postgis_deps: - - "{{ _libgeos_package_name[ansible_os_family][ansible_distribution_major_version | int] }}" + - "{{ _libgeos_package_name[ansible_os_family][ansible_distribution_major_version | int] | _libgeos_package_name[ansible_os_family]['default'] | default(_libgeos_package_name['default'])}}" - "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}" - "postgresql-{{ postgresql_version }}-postgis-scripts" From 4abe051636afc247d19efd03baa9451a6dcd0c8b Mon Sep 17 00:00:00 2001 From: Florent THOMAS Date: Wed, 27 Dec 2023 10:15:23 +0100 Subject: [PATCH 7/7] FIX bad syntax --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 64a82e7bf..41c6b9544 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -62,7 +62,7 @@ _libgeos_package_name: 12: "libgeos-c1v5" postgresql_ext_postgis_deps: - - "{{ _libgeos_package_name[ansible_os_family][ansible_distribution_major_version | int] | _libgeos_package_name[ansible_os_family]['default'] | default(_libgeos_package_name['default'])}}" + - "{{ _libgeos_package_name[ansible_os_family][ansible_distribution_major_version | int] | default(_libgeos_package_name[ansible_os_family]['default'])}}" - "postgresql-{{ postgresql_version }}-postgis-{{ postgresql_ext_postgis_version }}" - "postgresql-{{ postgresql_version }}-postgis-scripts"