SQLAlchemy + Postgres Cheatsheet 16 — VACUUM, Bloat, and Maintenance
Cheatsheet: autovacuum settings, manual vacuum, finding bloat, REINDEX CONCURRENTLY, table stats.
Cheatsheet: autovacuum settings, manual vacuum, finding bloat, REINDEX CONCURRENTLY, table stats.
Cheatsheet: enable pg_stat_statements, find top queries, auto_explain, slow-query log via SQLAlchemy events.
Cheatsheet: pg_dump, pgBackRest, WAL archiving, PITR, restore testing.
Cheatsheet: PgBouncer config, app vs admin roles, statement_timeout, max_connections, scaling tactics.
Cheatsheet: pg_stat_statements, pg_trgm, citext, uuid-ossp, pgvector, pgcrypto, pg_partman, hypopg, pg_repack.
Practical Postgres-backed queues: SKIP LOCKED for concurrency, LISTEN/NOTIFY for low-latency wake-up, retries, dead-letter, and when to graduate to Kafka.
Practical Postgres locking: SELECT FOR UPDATE, NOWAIT, SKIP LOCKED, advisory locks, isolation levels, and how to debug locking problems.
Practical Postgres JSONB: GIN indexes, jsonb_path queries, partial indexes, when to denormalize vs normalize, and the perf gotchas.
Production Postgres partitioning: range / list / hash, when partitioning helps vs hurts, pg_partman automation, and pitfalls with foreign keys and indexes.
Choosing a Postgres replication topology: streaming for HA, logical for upgrades / cross-cluster, cascading for fanout, and pitfalls in each.