Postgres High Availability
Patroni, repmgr, Stolon, PgBouncer, CloudNativePG — running Postgres in production.
Replication / failover orchestrators
- ★ Patroni (Zalando) — distributed-coordination-backed orchestrator (etcd / Consul / ZooKeeper / k8s); auto-failover; the default for self-host Postgres HA.
- ★ CloudNativePG — k8s operator (CRD-driven); the default for Postgres on k8s in 2026.
- Stolon (Sorint.lab) — older Patroni alternative.
- repmgr (2ndQuadrant / EDB) — repmgr / repmgrd; older but still used.
- pg_auto_failover (Citus / Microsoft) — simpler 3-node setup; one monitor.
- pgpool-II — connection pool + load balance + failover; older.
Connection poolers
- ★ PgBouncer — universal; tiny; transaction- or session-pooling. Default in front of every Postgres.
- ★ Pgpool-II — adds load balancing across replicas; heavier.
- Supavisor (Supabase) — modern Elixir-based pooler; multi-tenant.
- Odyssey (Yandex) — multi-threaded PgBouncer alternative.
Logical replication / CDC
- Postgres native logical replication — built-in; per-table; for upgrades / migrations / data fan-out.
- pglogical — older external replication.
- Debezium — CDC into Kafka / NATS / Pulsar.
- Sequin / Materialize / Striim — managed CDC platforms.
Backups
- ★ WAL-G — continuous WAL archiving + base backups; PITR. Default for self-host.
- pgBackRest — full-featured; great for big DBs; more setup.
- Barman — older WAL archiver.
- pg_dump / pg_dumpall — logical backups; complement, not replace, WAL.
- See Backup.
Hosted / managed Postgres
See Web Dev Databases — Neon (branching), Supabase, Crunchy Bridge, AWS RDS / Aurora, GCP Cloud SQL, Azure DB.
Performance / tuning
pgtune— generatepostgresql.conffor your hardware.- PgHero — easy performance dashboard.
- pg_stat_statements — built-in; what's slow.
- auto_explain — log slow query plans.
- pgBadger — log analyzer.
@embarrassingly/cloud-pg-tunestyle tools — many.
Extensions worth knowing
- pgvector — embeddings + vector search.
- pgvectorscale — for huge vector workloads.
- TimescaleDB — time-series.
- Citus — sharding.
- PostGIS — spatial.
- pg_partman — auto-partitioning.
- pgaudit — audit logging.
- pg_cron — schedule jobs in-DB.
- pgmq — message queue extension.
HA topologies
Classic 3-node Patroni:
- 3 Postgres nodes (1 primary, 2 replicas).
- etcd / Consul cluster (3 or 5 nodes) for leader election.
- HAProxy or similar pointing at the current primary based on Patroni's API.
- PgBouncer in front for connection pooling.
CloudNativePG on k8s:
- 3-replica
ClusterCRD. - Operator handles failover, backups (to S3), upgrades.
service-rwandservice-roservices route to primary / replicas.
Cheap-and-cheerful:
- Single primary + a logical replica for read-only reporting.
- WAL-G to R2 for PITR.
- Restore from WAL-G if primary dies. RTO ~minutes.
Patterns to adopt
- ★ Always run PgBouncer. Connection storms kill Postgres before anything else.
- Use logical replication for major-version upgrades. Replicate to a new-version replica, then switch.
- WAL archive to object storage from day 1.
- Test restore drills. A WAL archive you've never restored is a hope.
- Pin extensions in IaC; don't
CREATE EXTENSIONad-hoc in prod. - Monitor replication lag — alert if > a few seconds.
Pick this if…
- Default self-host HA: Patroni + etcd + HAProxy + PgBouncer + WAL-G.
- Default k8s: CloudNativePG.
- Just want managed Postgres: Neon or Crunchy Bridge.
- Backup + PITR: WAL-G or pgBackRest.
- Connection pool: PgBouncer (always).