Quick PostgreSQL tuning notes
My little database became a big database, 100 gigs, and I never bothered to tune PostgreSQL. The defaults look tuned for a machine with about 1 gig of RAM total. I’ve got 8 gigs. Here’s a quick stab at some tuning:
shared_buffers = 256MB work_mem = 16MB maintenance_work_mem = 256MB wal_buffers = 16MB checkpoint_segments = 10 effective_cache_size = 1024MB
I’m just guessing, not testing. Got some hints from
- http://postgis.refractions.net/docs/ch06.html
- https://gist.github.com/91deaf2dd12fe26c8e31
- http://media.revsys.com/talks/djangocon/2011/secrets-of-postgresql-performance.pdf
Those defaults blow out MacOS’ default shared memory limits. I bumped them up with notes from here and here
$ sudo sysctl -w kern.sysv.shmmax=536870912 $ sudo sysctl -w kern.sysv.shmall=131072