Skip to content

Commit

Permalink
automate the tuning of shared_buffers and effective_cache_size
Browse files Browse the repository at this point in the history
by default, 25% of RAM for shared_buffers and 75% for effective_cache_size.

You can override these values.
  • Loading branch information
vitabaks committed Mar 3, 2023
1 parent 2483a71 commit b6be91f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ postgresql_parameters:
- { option: "max_locks_per_transaction", value: "64" } # raise this value (ex. 512) if you have queries that touch many different tables (partitioning)
- { option: "max_prepared_transactions", value: "0" }
- { option: "huge_pages", value: "try" } # or "on" if you set "vm_nr_hugepages" in kernel parameters
- { option: "shared_buffers", value: "512MB" } # please change this value
- { option: "shared_buffers", value: "{{ (ansible_memtotal_mb * 0.25)|int }}MB" } # by default, 25% of RAM
- { option: "effective_cache_size", value: "{{ (ansible_memtotal_mb * 0.75)|int }}MB" } # by default, 75% of RAM
- { option: "work_mem", value: "128MB" } # please change this value
- { option: "maintenance_work_mem", value: "256MB" } # please change this value
- { option: "effective_cache_size", value: "4GB" } # please change this value
- { option: "checkpoint_timeout", value: "15min" }
- { option: "checkpoint_completion_target", value: "0.9" }
- { option: "min_wal_size", value: "2GB" }
Expand Down

0 comments on commit b6be91f

Please sign in to comment.