Skip to content

Commit b6be91f

Browse files
committed
automate the tuning of shared_buffers and effective_cache_size
by default, 25% of RAM for shared_buffers and 75% for effective_cache_size. You can override these values.
1 parent 2483a71 commit b6be91f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vars/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ postgresql_parameters:
176176
- { option: "max_locks_per_transaction", value: "64" } # raise this value (ex. 512) if you have queries that touch many different tables (partitioning)
177177
- { option: "max_prepared_transactions", value: "0" }
178178
- { option: "huge_pages", value: "try" } # or "on" if you set "vm_nr_hugepages" in kernel parameters
179-
- { option: "shared_buffers", value: "512MB" } # please change this value
179+
- { option: "shared_buffers", value: "{{ (ansible_memtotal_mb * 0.25)|int }}MB" } # by default, 25% of RAM
180+
- { option: "effective_cache_size", value: "{{ (ansible_memtotal_mb * 0.75)|int }}MB" } # by default, 75% of RAM
180181
- { option: "work_mem", value: "128MB" } # please change this value
181182
- { option: "maintenance_work_mem", value: "256MB" } # please change this value
182-
- { option: "effective_cache_size", value: "4GB" } # please change this value
183183
- { option: "checkpoint_timeout", value: "15min" }
184184
- { option: "checkpoint_completion_target", value: "0.9" }
185185
- { option: "min_wal_size", value: "2GB" }

0 commit comments

Comments
 (0)