more autotuning

This commit is contained in:
ace 2024-01-29 13:33:26 +03:00
parent c8e0761c07
commit c598622364
Signed by: ace
GPG Key ID: 2C08973DD37A76FD

View File

@ -34,11 +34,13 @@ postgresql_recovery_target_time: ""
postgresql_promote_trigger_file: "{{ postgresql_data_dir }}/promote.trigger"
postgresql_password_encryption_algorithm: "scram-sha-256"
postgresql_max_connections: '1000'
postgresql_storage_type: 'ssd'
postgresql_default_parameters:
data_directory: '{{ postgresql_data_dir }}'
archive_mode: "{{ postgresql_archive_mode | default('on') }}"
listen_addresses: '*'
max_connections: '1000'
max_connections: '{{ postgresql_max_connections }}'
superuser_reserved_connections: '5'
shared_buffers: '{{ (ansible_memory_mb.real.total * 0.25) | round | int }}MB'
huge_pages: 'try'
@ -47,8 +49,14 @@ postgresql_default_parameters:
max_parallel_workers: '{{ ansible_processor_vcpus }}'
max_parallel_workers_per_gather: '{{ (ansible_processor_vcpus / 2) | round | int }}'
max_parallel_maintenance_workers: '{{ (ansible_processor_vcpus / 2) | round | int }}'
max_wal_size: '1GB'
min_wal_size: '80MB'
work_mem: '{{ (((ansible_memory_mb.real.total - ((ansible_memory_mb.real.total * 0.25) | round | int)) / (postgresql_max_connections | int * 3) / ((ansible_processor_vcpus / 2) | round | int)) + 4) | round | int }}MB'
maintenance_work_mem: '{{ (ansible_memory_mb.real.total * 0.0625) | round | int }}MB'
effective_cache_size: '{{ (ansible_memory_mb.real.total * 0.8) | round | int }}MB'
random_page_cost: "{{ '1.1' if postgresql_storage_type == 'ssd' else '4' }}"
effective_io_concurrency: "{{ '200' if postgresql_storage_type == 'ssd' else '2' }}"
min_wal_size: '1GB'
max_wal_size: '4GB'
wal_buffers: '16MB'
log_destination: 'stderr'
logging_collector: 'on'
log_directory: 'log'