Home / Databases / PostgreSQL

PostgreSQL

PostgreSQL: vacuum, replication, Patroni HA, pgBackRest, locks and upgrades. 33 posts.

PostgreSQL / How-to

Advisory: choosing a managed PostgreSQL service - RDS, Aurora, Azure Flexible Server, Cloud SQL, AlloyDB or OCI

Managed PostgreSQL services look similar but differ in storage architecture, HA behaviour, extensions, version support and limits on superuser access. List what your applications need (extensions, versions, replication, scale), compare services on those points within your cloud, and test failover, upgrades and performance before committing.

2 min readIntermediate

PostgreSQL / Cheat sheet

Advisory: PostgreSQL backup approach - pg_dump, pgBackRest, Barman, WAL-G or managed PITR

Logical dumps and physical backups solve different problems. Use physical backups with WAL archiving for point-in-time recovery of whole clusters, logical dumps for portability and single-object restores, compare pgBackRest, Barman and WAL-G for self-managed servers, and rely on managed PITR plus extra copies on cloud services.

2 min readIntermediate

PostgreSQL / Runbook

Sev1: Patroni cluster has no leader and PostgreSQL is read-only everywhere

patronictl list shows no Leader, every node is a replica or stopped, and applications can't write. The usual causes are a lost etcd quorum, no candidate passing the failover rules, or a paused cluster. Diagnose each one and get a leader back without risking split-brain.

3 min readAdvanced

PostgreSQL / Runbook

Sev1: PostgreSQL refuses writes to avoid transaction ID wraparound

PostgreSQL warns that a database must be vacuumed within N transactions, or stops accepting writes altogether. Find what is holding back freezing, such as long transactions, abandoned replication slots or orphaned prepared transactions, remove it, and run a targeted VACUUM to get write access back.

3 min readAdvanced

PostgreSQL / Runbook

Transformation: PostgreSQL on EC2 or on-premises to Aurora PostgreSQL

Move a self-managed PostgreSQL database to Aurora PostgreSQL. Check extensions and settings, choose dump/restore, native logical replication or AWS DMS, run the cut-over, then adjust for how Aurora storage, replicas and failover behave.

3 min readIntermediate

PostgreSQL / Cheat sheet

PostgreSQL DBA cheat sheet: psql, sessions, locks, vacuum, replication and backups

The PostgreSQL commands and queries DBAs use every week. Covers psql shortcuts, server and database info, active sessions and locks, slow queries with pg_stat_statements, sizes and bloat, vacuum and autovacuum, indexes, replication, backups with pg_dump and pgBackRest, and roles.

5 min readIntermediate

PostgreSQL / How-to

PostgreSQL high availability with Patroni, etcd and HAProxy

Build a three-node PostgreSQL cluster with automatic failover using Patroni and etcd, route clients with HAProxy or a VIP, choose synchronous mode settings, and run switchovers and health checks.

2 min readAdvanced