π PostgreSQL (your default database)
Core β Advanced
- SQL fluency: joins, CTEs, window functions,
GROUP BY/HAVING,LATERAL, upserts (ON CONFLICT) - Schema design: normalization (to 3NF) and deliberate denormalization; constraints (FK, UNIQUE, CHECK, exclusion constraints β for seat/time overlaps)
- Data types:
jsonb, arrays,uuid,timestamptz(always),numericfor money, enums - Indexes: B-tree, composite ordering, partial, covering (
INCLUDE), expression, GIN (jsonb/full-text), GiST, BRIN -
EXPLAIN (ANALYZE, BUFFERS): seq scan vs index scan vs bitmap; row estimates; join strategies - MVCC, VACUUM/autovacuum, bloat, transaction ID wraparound (awareness)
- Isolation levels in Postgres (Read Committed default; Repeatable Read = snapshot; Serializable = SSI)
- Locks: row locks,
FOR UPDATE,SKIP LOCKED(job queues), advisory locks, deadlock detection - Connection pooling: HikariCP / pgxpool + PgBouncer (transaction mode caveats)
- Replication: streaming (physical), logical replication; read replicas; failover (Patroni awareness)
- Partitioning (declarative, range/list/hash); when to shard (Citus awareness)
- Full-text search (
tsvector); pgvector for embeddings β - Observability:
pg_stat_statements,pg_stat_activity, slow query log,auto_explain - Backups:
pg_dumpvs PITR (WAL archiving) - Zero-downtime migrations (add a column nullable β backfill β constraint;
CREATE INDEX CONCURRENTLY)
π§ͺ Labs (π’ warm-up β π‘ core β π΄ hard β β« boss)
- π’ pgexercises.com (all sections)
- π‘ 5M-row
runs/run_events: optimize 5 queries with EXPLAIN; before/after - π΄ An RLS multi-tenancy + cross-tenant test suite
- π΄ A
SKIP LOCKEDtask queue with leases; partitionrun_eventsby month - β« Zero-downtime migration drill: add a NOT NULL column + an index to a hot table under load (
lock_timeout,CONCURRENTLY)
π§ Cognitive tasks
- Predict β verify plans, lock waits, and bloat
- Symptom β hypotheses: βDB CPU 90%, same QPS as yesterdayβ
π°οΈ Orbit integration
- Control plane DB, engine event history, pgvector for RAG
Go deeper
βοΈ PostgreSQL Internals Β· Database Internals
Resources
- PostgreSQL docs β (very high quality) Β· Use The Index, Luke β Β· The Art of PostgreSQL (Fontaine)
- PostgreSQL 14 Internals (Rogov, free) Β· Crunchy Data + pganalyze blogs Β· CMU 15-445