Skip to content

Instantly share code, notes, and snippets.

Last active October 27, 2022 05:39
  • Star 10 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
PostgreSQL Configuration Optimization

PostgreSQL Configuration Optimization


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