Project

General

Profile

Actions

User story #2049

closed

It seems that default configurations of postgresql are not optimal. We need to add some optimizations to our packages

Added by Nicolas PERRON over 12 years ago. Updated about 7 years ago.

Status:
Rejected
Priority:
2
Assignee:
-
Category:
Packaging
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

Description

The default (out-of-the-box) configuration of Postgres is really not compliant for large (or normal) machines. It uses a really small amount of memory

The location of the file is
/etc/postgresql/8.x/main/postgresql.conf
/var/lib/pgsql/data/postgresql.conf (on a SuSE system)

Suggested values on a large node

Amount of System V shared memory

A reasonable starting value for shared_buffers is 1/4 of the memory in your system

  • shared_buffers = 1GB

Note : you may need to set the proper amount on the system (ok on the default install on the large EC2 machine)

$ sysctl -w kernel.shmmax=1073741824

Ref : http://www.postgresql.org/docs/8.4/interactive/kernel-resources.html#SYSVIPC

Memory for complex operations

Complex query
  • work_mem = 24MB
  • max_stack_depth = 4MB
Complex maintenance (index, vacuum)
  • maintenance_work_mem = 240MB

Write ahead log

Size of the write ahead log
  • wal_buffers = 4MB

Query planner

Gives hint to the query planner about the size of disk cache
Setting effective_cache_size to 1/2 of total memory would be a normal conservative setting
  • effective_cache_size = 1024MB

Suggested values on a not so large node

  • shared_buffers = 128MB
  • work_mem = 8MB
  • max_stack_depth = 3MB
  • maintenance_work_mem = 64MB
  • wal_buffers = 1MB
  • effective_cache_size = 128MB
Actions

Also available in: Atom PDF