Skip to content

Instantly share code, notes, and snippets.

@rapimo
Created November 17, 2012 11:02
Show Gist options
  • Save rapimo/4094917 to your computer and use it in GitHub Desktop.
Save rapimo/4094917 to your computer and use it in GitHub Desktop.
postgres kernel ressources
get https://github.com/gregs1104/pgtune
see http://www.postgresql.org/docs/8.4/static/kernel-resources.html for reasonable kernel conf
play around with kernel settings without restart
sudo sysctl -w kern.sysv.shmmax=4409466880 #4GB must be a multiplier of 4096
kern.sysv.shmmax: 4194304 -> 1073741824
shmall must be shmax / pagesize
get pagesize with
pagesize
sudo sysctl -w kern.sysv.shmall=1076530
save to
sudo vim /etc/sysctl.conf
if
tail -f /usr/local/var/postgres/server.log
doesn't show any errors
and restart
TL;DR
For my 16GB RAM MacBook pro I use the following settings
/usr/local/var/postgres/postgresql.conf
maintenance_work_mem = 1GB
checkpoint_segments = 16
checkpoint_completion_target = 0.9
effective_cache_size = 12GB
work_mem = 1GB
shared_buffers = 4GB
wal_buffers = 16MB
max_connections = 80
/etc/sysctl.conf
kern.sysv.shmmax=5368709120
kern.sysv.shmmin=1
kern.sysv.shmmni=256
kern.sysv.shmseg=64
kern.sysv.shmall=1310720
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment