PostgreSQL Configuration For Humans
PostgreSQL Configuration For Humans
for Humans
PostgresConf US 2018
PostgreSQL configuration
Advanced stuff:
✓ Developer parameters
✓ Compile-time #defines
PostgresConf US 2018
Why configure PostgreSQL?
PostgresConf US 2018
Performance, performance, performance
Do,
Do, Do
Usual PostgreSQL advice: (unless you run on a Raspberry PI 1st
gen)
PostgresConf US 2018
Performance, performance, performance
pg_bench, scale
2000, m4.large
(2 vCPU, 8GB
RAM, 1k IOPS
PostgresConf US 2018
Performance, performance, performance
pg_bench, scale
2000, m4.large
(2 vCPU, 8GB
RAM, 1k IOPS
PostgresConf US 2018
postgresql.conf parameters
PostgresConf US 2018
Tunable postgresql.conf parameters
PostgresConf US 2018
Some ideas about PostgreSQL tuning…
PostgresConf US 2018
Disclaimer
PostgresConf US 2018
initdb
PostgresConf US 2018
Db connections 101
✓ Default is 100
PostgresConf US 2018
Db connections 101
PostgresConf US 2018
Db connections 101
pg_bench, scale
2000, m4.large
(2 vCPU, 8GB
RAM, 1k IOPS
# concurrent connections
PostgresConf US 2018
Db connections 101
pg_bench, scale
2000, m4.large
(2 vCPU, 8GB
RAM, 1k IOPS
# concurrent connections
PostgresConf US 2018
Db connections 101
✓ PgBouncer!
Cores
Connections= x scale factor
% effective utilization connection
PostgresConf US 2018
shared_buffers
✓ Done!
PostgresConf US 2018
work_mem
✓ Max local process memory used for operations like sort and
joins in queries
✓ Not the same if you are OLTP, OLAP, DW (small to very large)
PostgresConf US 2018
Other memory/disk tunables
PostgresConf US 2018
This requires restart, think carefully
✓ cluster_name
PostgresConf US 2018
The tyranny of max_*
PostgresConf US 2018
Autovacuum / vacuum
PostgresConf US 2018
Autovacuum / vacuum
General advice:
✓ Reduce autovacuum_vacuum_cost_delay
PostgresConf US 2018
Checkpoints and bgwriter
PostgresConf US 2018
Logging
✓ Turn on:
‣ logging_collector
‣ log_checkpoints
‣ log_connections, log_disconnections
PostgresConf US 2018
Other interesting parameters
✓ max_standby_{archive,streaming}_delay and
hot_standby_feedbak: keep replication query conflicts burden
on the primary or secondaries?
PostgresConf US 2018
Was that too much?
Tools to help?
PostgresConf US 2018
Was that too much? Tools to help?
PostgresConf US 2018
Was that too much? Tools to help?
PostgresConf US 2018
Was that too much? Tools to help?
PostgresConf US 2018
PostgreSQL wants a new configuration tool
(IMVHO)
PostgresConf US 2018
postgresqlco.nf
PostgresConf US 2018
postgresqlco.nf
PostgresConf US 2018
postgresqlco.nf
PostgresConf US 2018
Subscribe on postgresqlco.nf
to become a beta tester!
PostgresConf US 2018
Questions?
www.ongres.com
@ongresinc