---
# file: roles/postgres/defaults/main/postgres_and_patroni.yml

pg_max_connections: 100
pg_shared_buffers: "128MB"

pg_timezone: Europe/Paris
pg_huge_pages: try
pg_statement_timeout: 0

# specific for ssd drives
pg_random_page_cost: 1.1
pg_effective_io_concurrency: 500
pg_maintenance_io_concurrency: 500

# specific config activation
pg_ssd: False
pg_logging: False
pg_log_filename_suffix: '%a_%H'
pg_log_min_duration_statement: '0'
pg_replication: False

# archive default
pg_archive_timeout: 2min

# replication default
pg_max_standby_archive_delay: 5min
pg_max_standby_streaming_delay: 5min
pg_max_wal_size: 10GB
pg_min_wal_size: 512MB

# master or slave runs additionnal script, any other thing create a standalone server
pg_replication_role: none

postgres_primary_conninfo_port: 5432
postgres_primary_conninfo_sslmode: "require"

# postgresql monitoring for XLOG/WAL changes depending on the installed postgresql version, version <= 9.6 are using the legacy query and postgresql >= 10 are using the modern query
postgres_zabbix_legacy_stat_replication_bytelag: 'SELECT pg_xlog_location_diff(pg_current_xlog_location(), sent_location) as byte_lag FROM pg_stat_replication'
postgres_zabbix_modern_stat_replication_bytelag: 'SELECT pg_wal_lsn_diff(pg_current_wal_lsn(), sent_lsn) as byte_lag FROM pg_stat_replication'

pg_synchronous_commit: "off"
pg_fsync: True

# pg_backup_service was in fact not useful on ZFS backed servers, deactivating it by default:
pg_backup_service: False

# pg user password hash
pg_md5: false
