Improve RAM usage allowance

Queries can spawn more processed and then use more RAM than
`shared_buffers`
This commit is contained in:
2026-04-11 14:53:28 +04:00
parent c92f9157a5
commit db9177c9c6

View File

@@ -44,13 +44,14 @@ action :create do
shared_buffers = if node['memory']['total'].to_i / 1024 < 1024 # < 1GB RAM
"128MB"
else # >= 1GB RAM, use 50% of total RAM
"#{node['memory']['total'].to_i / 1024 / 2}MB"
else # >= 1GB RAM, use 25% of total RAM
"#{node['memory']['total'].to_i / 1024 / 4}MB"
end
additional_config = {
max_connections: 200, # default
shared_buffers: shared_buffers,
work_mem: "4MB",
unix_socket_directories: "/var/run/postgresql",
dynamic_shared_memory_type: "posix",
timezone: "UTC", # default is GMT