Skip to content

Instantly share code, notes, and snippets.

@rgreenjr
Last active March 15, 2024 13:44
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • 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