Shipping Postgres means backups tested, monitoring autovacuum, least-privilege roles, connection pooling, and migration discipline—not only correct SELECT syntax.
Checklist
- Automated backups + monthly restore drill
- Monitoring: connections, replication lag, disk, autovacuum
- Indexes driven by EXPLAIN on real workloads
- Secrets in env vars; TLS enforced
- Pooler in front of app servers
- Extensions version-pinned and documented
Dangerous operations
BEGIN;
SELECT COUNT(*) FROM orders WHERE status = 'stale';
-- confirm count
DELETE FROM orders WHERE status = 'stale';
-- COMMIT; or ROLLBACK;Practice: Review prior lessons in psql, then attempt interview-style queries without peeking.
Next steps
Deepen app integration on Django and Python tracks. Compare engines on MySQL. Revisit fundamentals on SQL when mentoring juniors.
Important interview questions and answers
- Q: Why restore drills?
A: Backups fail silently until restore proves data integrity. - Q: Superuser in app?
A: Never—use scoped roles and RLS for multi-tenant data.
Self-check
- Name three production monitoring areas for Postgres.
- What should you run before a mass DELETE?
Tip: Capstone: backups tested, pooler, least privilege, EXPLAIN-driven indexes. Next: deepen Django/Python tracks.
Interview prep
- Before mass DELETE?
SELECT count with same WHERE inside a transaction.
- Autovacuum?
Must stay enabled—tune rather than disable on churn tables.