55 articles
Knowledge Base
PostgreSQL
55 articles in the PostgreSQL category · page 1 of 3.
- PgBouncer connection pooling for PostgreSQL Install PgBouncer in front of PostgreSQL, choose a pool mode, and size the pools so an application running on several replicas stays under max_connections.
- Deploying Citus (sharded PostgreSQL) — coordinator + workers on AlmaLinux 9 Stand up a Citus 12 cluster on AlmaLinux 9 with a coordinator and three workers, distribute tables by tenant id, and verify shard placement and query routing.
- TimescaleDB hypertables for time-series on PostgreSQL Run time-series workloads on PostgreSQL with TimescaleDB — hypertables, chunk sizing, continuous aggregates, retention policies, and compression.
- Set up Barman as a PostgreSQL backup server with point-in-time recovery Set up Barman on its own host to back up PostgreSQL and restore it to any point in time. You will stream base backups and the write-ahead log (WAL) over a replication slot, then rehearse a restore with barman recover --target-time.
- Restore a PostgreSQL cluster to a point in time with pgBackRest Someone ran a destructive statement at 14:32 and you need the database as it was at 14:31. Confirm the backup set and WAL continuity, pick the right recovery target, restore to a safe destination, inspect before promoting, then take a fresh full backup.
- Allocate explicit huge pages for PostgreSQL shared_buffers on Linux Size vm.nr_hugepages from postgres -C shared_memory_size_in_huge_pages instead of guessing, choose huge_pages = on or try deliberately, grant the right permissions, and confirm from /proc/meminfo and the postmaster status that the pages are in use.
- Manage PostgreSQL Replication Slots to Prevent WAL Bloat Create, monitor, and clean up physical and logical replication slots on PostgreSQL 14-17. Read pg_replication_slots and wal_status, measure retained WAL, cap it with max_slot_wal_keep_size, and drop orphaned slots before pg_wal fills the disk.
- WAL-G Continuous Backup and PITR for Self-Managed PostgreSQL Ship PostgreSQL WAL and base backups to S3-compatible object storage with WAL-G, then restore a self-managed cluster to an exact point in time.
- Diagnosing table and index bloat in PostgreSQL — measure before you rewrite Measure PostgreSQL bloat with pgstattuple and pg_stat_user_tables, read autovacuum progress, and decide when routine VACUUM is enough versus pg_repack or VACUUM FULL.
- PostgreSQL major version upgrade with pg_upgrade — the in-place runbook Why dump and restore stops scaling, what pg_upgrade --check catches, the --link vs --clone vs copy trade-off, extension updates, the post-upgrade ANALYZE nobody remembers, and how far rollback actually goes.
- PostgreSQL transaction ID wraparound: the emergency runbook Your log says the database must be vacuumed within N transactions and the number keeps falling. Find what is pinning the XID horizon, clear it, freeze the offending tables, and stop it from recurring.
- PostgreSQL Point-in-Time Recovery with WAL Archiving Configure continuous WAL archiving on self-managed PostgreSQL 15/16/17, take a pg_basebackup base backup, and restore to an exact moment with restore_command, recovery_target_time, and recovery.signal — with the restore drill spelled out.
- How to Back Up PostgreSQL with pg_basebackup Take a physical base backup of a running PostgreSQL cluster with pg_basebackup, stream the WAL so it is restorable, and recover from it — with a note on point-in-time recovery and where pg_dump fits instead.
- Find slow queries in PostgreSQL with pg_stat_statements Enable pg_stat_statements and rank queries by total_exec_time, mean_exec_time, and calls to find the statements that actually cost your database the most.
- Read a PostgreSQL query plan: EXPLAIN and EXPLAIN ANALYZE Why is my query slow? Learn to run postgres explain analyze and read the query plan — seq scans, bad row estimates, nested loops, and sorts spilling to disk.
- Database backup verification — how to know your restore actually works Backup verification across four levels — storage integrity, schema restore, data restore, application restore — with automation patterns for MySQL, PostgreSQL, and MongoDB.
- Patroni — production PostgreSQL high-availability cluster architecture Patroni PostgreSQL HA in production — etcd quorum, leader election, sync vs async replicas, HAProxy routing, watchdog, and the decisions that determine whether your cluster survives a real outage.
- Patroni failover behavior — what actually happens in the 30 seconds after Patroni failover behavior in detail — the leader-lock expiry, the replica race, HAProxy convergence, the sync-promotion data-loss window, and what the application actually sees during a real failover.
- Full-text search in PostgreSQL with tsvector and tsquery Build a production full-text search in PostgreSQL — generated tsvector columns, GIN indexes, ranking, multilingual dictionaries, and operational care.
- Postgres timeline divergence after failback — pg_rewind vs base backup After a failover the old primary cannot rejoin as a standby because it's on a different timeline. The decision tree between pg_rewind (fast) and full pg_basebackup (slow but always safe).
- PostgreSQL materialized views with concurrent refresh Use materialized views in PostgreSQL — REFRESH MATERIALIZED VIEW CONCURRENTLY, the unique-index prerequisite, and the operational pattern for dashboards.
- PostgreSQL streaming-replication manual promotion runbook When Patroni isn't in the picture or automation is unavailable, you still need to promote a standby cleanly. Exact pg_ctl, recovery, and verification flow for a manual primary promotion.
- Splitting reads and writes in a managed Postgres setup Read replicas only help when the application sends reads to them. Here is how we route read and write traffic on managed Postgres without breaking transactions.
- PostgreSQL VACUUM and autovacuum — keeping bloat in check How VACUUM and autovacuum work, the parameters that matter on busy tables, how to read pg_stat_user_tables, and what to do about transaction-ID wraparound.