Skip to content

Instantly share code, notes, and snippets.

@CarlosEspejo
Last active October 13, 2015 16:14
Show Gist options
  • Save CarlosEspejo/86c98f5835e0c2d6101f to your computer and use it in GitHub Desktop.
Save CarlosEspejo/86c98f5835e0c2d6101f to your computer and use it in GitHub Desktop.
Postgres Modern Tuning settings
# Borrowed from this talk
# https://www.youtube.com/watch?v=dBeXS5aFLNc
# http://jberkus.github.io/performance_in_15_min/index.html?utm_source=postgresweekly&utm_medium=email#37
# Thank you Josh!!
# Memory Settings
shared_buffers = 2GB # RAM/4 up to 8GB
work_mem = 32MB # limit: RAM/(max_connections/2)
# 8MB to 32MB: web
# 128MB to 1GB: reporting
effective_cache_size = 6GB # 3/4 of RAM
wal_buffers = 64MB # just set it
maintainence_work_mem = 512MB # RAM/32, more for reporting
# WAL
checkpoint_segments = 64 # make WAL bigger
# space / 32MB
checkpoint_completion_target = 0.9
# More Settings
stats_temp_directory = '/mnt/ramdisk' # helps with latency
random_page_cost = 1.5 # for AWS, SSD
effective_io_concurrency = 4 # for AWS, SSD, RAID
# Presentation Recap
- Do Less querying
- fix resource-hungry requests
- get adequate hardware
- scale your infrastructure
- tune the config a little
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment