# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# Memory units:  kB = kilobytes        Time units:  ms  = milliseconds
#                MB = megabytes                     s   = seconds
#                GB = gigabytes                     min = minutes
#                                                   h   = hours
#                                                   d   = days


#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '/var/lib/postgresql/9.4/main'
hba_file = '/etc/postgresql/9.4/main/pg_hba.conf'
ident_file = '/etc/postgresql/9.4/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/9.4-main.pid'


#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'
port = 5432
max_connections = ${10 + 10 * cores}

unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories

# - Security and Authentication -
ssl = false

#------------------------------------------------------------------------------
# RESOURCE USAGE (except WAL)
#------------------------------------------------------------------------------

# - Memory -
shared_buffers = 100MB
work_mem = 20MB
maintenance_work_mem = 50MB

#------------------------------------------------------------------------------
# WRITE AHEAD LOG
#------------------------------------------------------------------------------

# - Settings -
wal_sync_method = fdatasync
wal_buffers = 8MB

# - Checkpoints -
checkpoint_segments = 16		# in logfile segments, min 1, 16MB each

#------------------------------------------------------------------------------
# QUERY TUNING
#------------------------------------------------------------------------------

effective_cache_size = 512MB

#------------------------------------------------------------------------------
# ERROR REPORTING AND LOGGING
#------------------------------------------------------------------------------

log_min_duration_statement = 200

# - What to Log -
log_checkpoints = off
log_line_prefix = '%t '

#------------------------------------------------------------------------------
# AUTOVACUUM PARAMETERS
#------------------------------------------------------------------------------

autovacuum = on
log_autovacuum_min_duration = 30000

# - Locale and Formatting -
datestyle = 'iso, mdy'
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'	

default_text_search_config = 'pg_catalog.english'
