silent_mode=on
log_line_prefix='%t:%r:%u@%d:[%p]: '
log_destination='syslog,stderr'
log_min_messages = notice
log_checkpoints=on
log_lock_waits=on # log lock waits >= deadlock_timeout

# performance hog on FreeBSD
update_process_title=off

# http://www.postgresql.org/docs/9.1/static/datatype-datetime.html#DATATYPE-DATETIME-DATE-TABLE
datestyle='iso, mdy'

lc_messages='en_US.UTF-8' # locale for system error message strings
lc_monetary='en_US.UTF-8' # locale for monetary formatting
lc_numeric='en_US.UTF-8' # locale for number formatting
lc_time='en_US.UTF-8' # locale for time formatting
default_text_search_config='pg_catalog.english'

# set to (core count * 2) + number of effective drive spindles
# http://postgresql.1045698.n5.nabble.com/pgbench-could-not-send-data-to-client-Broken-pipe-td2808314.html
max_connections=32

# default value of 4.0 is too high for systems with lot of RAM and very good I/O
random_page_cost=2.0

# a good starting value is number of drives in raid array
# not supported on FreeBSD ?
#effective_io_concurrency=8

# help autovacuum not fall behind (with a system with good I/O)
autovacuum_vacuum_cost_delay=1ms # default=20ms

# if server OS does not keep up with autovacuum_vacuum_cost_delay, 
# then increase autovacuum_cost_limit
#autovacuum_cost_limit=-1 # by default, same as vacuum_cost_limit (200)

checkpoint_segments=32
checkpoint_completion_target=0.9 # default=0.5

# values assume 64G of RAM
shared_buffers=2GB # value = 25+% of available ram, max 2GB
effective_cache_size=32GB # value = OS filesystem cache size (run top command and add free+cached numbers)
maintenance_work_mem=4GB # value = 5% of ram

# should be kept low and increased on demand for client session doing lot of sorting
work_mem=512MB # value = (effective_cache_size - shared_buffers) / max_connections / 2

# buffer size for WAL segment (only a single segment need to be buffered at a time)
# starting with PostgreSQL 9.1, it defaults to being 1/32 of the size of shared_buffers, with an upper limit of 16MB
#wal_buffers=16MB

# not really necessary on ZFS
# see chapter 4, ZFS in PostgreSQL 9.0 High Performance by Gregory Smith
full_page_writes=off

# check current value with 'SHOW wal_sync_method;' (fsync on FreeBSD 9.0)
# default preferred order is open_datasync, fdatasync, fsync, fsync_writethrough, open_sync
# fsync_writethrough makes sure the OS clears any write-back caches, but not the entire hard drive cache
# NOTE: fsync seems to be the only method supported on FreeBSD on EC2 ?!
#wal_sync_method=fsync_writethrough

# disabling synchronous_commit provides a large boost in how many updates can be done per second
# but last committed transaction may be lost in case of power failure, thought with no data corruption
# set to ON for client sessions writing important data with 'SET LOCAL synchronous_commit TO ON;'
synchronous_commit=off

# guarantee a real commit at most xxx ms after the client commits (if synchronous_commit=off)
#wal_writer_delay=600ms # default = 600ms

# ONLY disable fsync if data corruption is not a concern (battery-backed cache, read-only/calculated databases, etc.)
# or during initial bulk loading
#fsync=off