Tech Lead Basics on Postgres
8 examples to get you started with tech leadership on Postgres - 5 basic and 3 intermediate.
Search across all documentation pages
8 examples to get you started with tech leadership on Postgres - 5 basic and 3 intermediate.
psql "$DATABASE_URL" -c "SELECT version();"
psql "$DATABASE_URL" -c "SELECT count(*) FROM pg_stat_activity;"pg_stat_statements).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 |
Related: Uptime SLOs for Datastores - error budgets
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 laterTech 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;Related: Connection Math - sizing formulas
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;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 |
idle in transaction.Related: Incident Basics - roles
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 upgradesTrack 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;Tech lead owns standards; staff+ DBAs own execution depth.
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+.
Reviewed by Chris St. John·Last updated Jul 16, 2026