Tech Lead Basics on Postgres
8 examples to get you started with tech leadership on Postgres - 5 basic and 3 intermediate.
Prerequisites
psql "$DATABASE_URL" -c "SELECT version();"
psql "$DATABASE_URL" -c "SELECT count(*) FROM pg_stat_activity;"- Read access to staging and production metrics (Grafana, pganalyze, or
pg_stat_statements). - A single schema style guide and migration tool for the org.
- Relationships with product, finance, and security for trade-off conversations.
Basic Examples
1. The Correctness / Uptime / Cost Triangle
Every decision moves one vertex at the expense of another.
| Priority shift | Example choice | Trade-off |
|---|---|---|
| Correctness up | Sync replication quorum | Higher write latency, cost |
| Uptime up | Extra HA replica + Patroni | Monthly spend, ops complexity |
| Cost down | Fewer replicas, smaller instances | Higher RTO, analytics contention |
- Document which vertex is non-negotiable per product line.
- Revisit quarterly when traffic shape changes.
Related: Uptime SLOs for Datastores - error budgets
2. Schema as Public API
Breaking schema changes are breaking API changes.
-- Breaking without expand/contract
ALTER TABLE invoices ALTER COLUMN amount TYPE numeric(10,2); -- rewrite risk
-- Safer expand path
ALTER TABLE invoices ADD COLUMN amount_v2 numeric(12,2);
-- app dual-write, backfill, cutover, drop old column later- Publish schema changelog for service owners.
- Require ERD or migration link in epic tickets.
3. Connection Math Ownership
Tech leads set pool policy; apps implement it.
max_connections = 200 on instance
PgBouncer pool_size = 80 per database
App pods = 40 x pool 20 = 800 client connections → MUST use PgBouncerSELECT count(*), state FROM pg_stat_activity GROUP BY 2;- Reject designs that open one connection per HTTP request without pooling.
- Plan capacity before Black Friday, not during.
Related: Connection Math - sizing formulas
4. Observability Minimum Bar
If you cannot see it, you cannot lead it.
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
SELECT query, calls, mean_exec_time, rows
FROM pg_stat_statements
ORDER BY total_exec_time DESC
LIMIT 10;- Top-N query report in weekly engineering review.
- Disk growth forecast monthly with finance copy.
5. Escalation Paths
Clarify who decides under pressure.
| Decision | Owner | Consult |
|---|---|---|
| Kill blocker session | On-call DBA | App lead |
| Failover | DBA + SRE | Product duty |
| Skip index for launch | Tech lead | DBA evidence |
| Major upgrade month | Tech lead + finance | Security EOL |
- Pre-approve termination policy for
idle in transaction. - Never improvise RACI during Sev-1.
Related: Incident Basics - roles
Intermediate Examples
6. Cross-Team Schema Council
Weekly 30-minute forum for shared database.
## Database Council Agenda
1. Pending migrations (risk tier)
2. Index requests queue
3. Incident learnings
4. EOL and extension upgrades- Representatives from each service using the database.
- Veto only on correctness/safety, not taste.
- Output: ADR links and approved migration order.
7. Technical Debt Register
Track data-layer debt like application debt.
| ID | Item | Risk | Owner | Target |
|----|------|------|-------|--------|
| DB-12 | Missing FK on refunds.order_id | correctness | payments | Q3 |
| DB-18 | orders_seq_scan 40% CPU | cost | platform | Q2 |SELECT relname, seq_scan, idx_scan
FROM pg_stat_user_tables
WHERE seq_scan > idx_scan AND seq_scan > 10000;- Tie debt burn-down to error budget recovery after incidents.
8. Hiring and Delegation
Tech lead owns standards; staff+ DBAs own execution depth.
- Interview loop includes SQL review and incident scenario.
- Pair new leads with DBA on first high-risk window.
- Grow internal runbook authors, not single hero on-call.
Related: Career Growth: DBA → Staff Data Engineer - growth path
Stack versions: This page was written for PostgreSQL 18.4 (stable 18, maintenance 17), pgvector 0.8+, PgBouncer 1.x, Patroni 3.x, and PostGIS 3.5+.