Skip to content

Instantly share code, notes, and snippets.

@rgreenjr
Last active June 4, 2024 09:36
Show Gist options
  • Save rgreenjr/3701082 to your computer and use it in GitHub Desktop.
Save rgreenjr/3701082 to your computer and use it in GitHub Desktop.
PostgreSQL Configuration Optimization

PostgreSQL Configuration Optimization

Memory

Only four values really matter:

  • shared-buffers: below 2GB: set it to 20% of full memory; below 32GB: 25% of your full memory.

  • work_mem: Start low at 32/64MB. Look for temporary file lines in logs. Then set it to 2-3x the largest temp file that you see. This setting can give a huge speed boost (if set properly).

  • maintenance_work_mem: Set it to 10% of system memory.

  • effective_cache_size: Only a hint to postgres. Just set it to the amount of filesystem cache available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment