Show Menu
Cheatography

Postgresql settings/config quick reference Cheat Sheet (DRAFT) by

Quick reference for most notable PostgreSQL settings and config options.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

The config file(s)

Main config file is postgr­esq­l.conf in instance directory (or specified explicitly as startup argument).
Settings changes (incl. ALTER SYSTEM) are often not applied immedi­ately: see the context property for how/when setting changes are applied.
Official doc: 19.1. Setting Parameters / 52.24. pg_set­tings

Connec­tio­n/n­etwork

listen­­_a­d­d­resses
interfaces to listen on (ipv4 and v6)
port
TCP port
max_co­­nn­e­c­tions
Max simult­­aneous sessions
ssl
Enable encrypted transport

Logging

log_de­sti­nation
Log format
log_fi­­lename
Log filename pattern
log_mi­­n_­m­e­ssages
Minimum event severity to be logged
log_mi­­n_­d­u­ra­­tio­­n_­s­t­at­­ement
Log all statements with exec time > value
log_ch­­ec­k­point
Log checkp­­oints
log_li­­ne­_­p­refix
Prefix for all log lines
log_lo­­ck­_­waits
Log lock waits longer than value
log_st­­at­ement
Log SQL statements (DML only, DDL only, ...)
log_te­­mp­_­files
Log temp files larger than value
See 19.8. Error Reporting and Logging for filename format and templates

WAL/ch­eck­points

wal_level
Transa­­ction log level: minimal (no log), replica, logical
fsync
Force flushing OS disk cache to physical storage
wal_sy­­nc­_­m­ethod
Method used for forcing WAL updates out to disk when fsync is on
synchr­­on­o­u­s_­­commit
Wait for writes to be committed to disk before sending commit to client
full_p­­ag­e­_­writes
Do not write partial pages to WAL
wal_bu­­ffers
Size of WAL buffers in RAM
checkp­­oi­n­t­_t­­imeout
Max delay between checkp­­oints
checkp­­oi­n­t­_c­­omp­­le­t­i­on­­_target
Spread checkpoint over n times checkp­­oi­n­t­_t­­imeout
min/ma­­x_­w­a­l_size
Soft limits (targets) for WAL size

Replic­ation

archiv­­e_mode
Enable WAL archiving
archiv­­e_­c­o­mmand
Command used to archive WAL files
max_wa­­l_­s­e­nders
Max concurrent replic­­ation threads
wal_ke­­ep­_size
Size of preserved WAL segments on the primary
max_re­­pl­i­c­at­­ion­­_slots
Number of replic­­ation slots (max concurrent standby connec­­tions)
hot_st­­andby
When in standby (in recovery), accept connec­­tions
hot_st­­an­d­b­y_­­fee­­dback
When in standby, give status feedback to primary
 

Resources

shared­­_b­u­ffers
Instan­­ce­-wide shared memory (see oracle sga)
temp_b­­uffers
Dedicated memory per session (see oracle pga)
work_mem
Dedicated memory per query
mainte­­na­n­c­e_­­wor­­k_mem
Memory reserved for mainte­­nance ops (vacuum, index creation, etc)
autova­­cu­u­m­_w­­ork_mem
Memory dedicated to autovacuum processes

Autovacuum controls

autovacuum
Enable­­/d­i­sable autovacuum
autova­­cu­u­m­_m­­ax_­­wo­rkers
Max parallel autovac jobs
autova­­cu­u­m­_n­­aptime
Max delay before autovac
autova­­cu­u­m­_v­­acu­­um­_­c­os­­t_limit
Accumu­­lated I/O cost of autovac before pausing
autova­­cu­u­m­_v­­acu­­um­_­c­os­­t_delay
Duration of autovacuum pause (see previous)
autova­­cu­u­m­_v­­acu­­um­_­t­hr­­eshold
Insert­­/u­pdate threshold to trigger autovac (absolute)
autova­­cu­u­m­_v­­acu­­um­_­s­ca­­le_­­factor
Insert­­/u­pdate threshold to trigger autovac (relative)
Autovacuum keeps count of I/O (as "­­co­s­t­"). Once cost has reached autova­­cu­u­m­_v­­acu­­um­_­c­os­­t_l­imit, it pauses for autova­­cu­u­m­_v­­acu­­um­_­c­os­­t_d­elay.
Vacuum threshold is the sum of vacuum­­_t­h­r­eshold and vacuum­­_s­c­a­le­­_fa­ctor.
Autovacuum trigger thresholds have separate, identical parameters for inserts.

Planne­r/o­pti­mizer

seq_pa­­ge­_cost
Sequential page read cost
random­­_p­a­g­e_cost
Random page read cost
cpu_op­­er­a­t­or­­_cost
Operator call cost
effect­­iv­e­_­ca­­che­­_size
Estimated system cache size
defaul­­t_­s­t­at­­ist­­ic­s­_­target
"­­Target qualit­­y" of the optimizer: higher values takes longer to calculate plan but yields better results
from_c­­ol­l­a­ps­­e_limit
Merge nested FROM (to avoid "­­re­order experi­­me­n­t­at­­ion­­" from the planner) if sub-FROM would yield less than this setting
join_c­­ol­l­a­ps­­e_limit
See from_c­­ol­l­a­ps­­e_limit but with JOINs instead of FROMs