PostgreSQL schemas for high-throughput writes
Most write bottlenecks are not PostgreSQL's fault — they are schema decisions that made every insert do more work than necessary.
Indexes have a cost
Every index is another structure to maintain on insert. Keep the hot path narrow: index what you query by, and measure before adding more.
Partition when the shape is known
Time-based partitioning works well for append-heavy event and analytics tables. It keeps indexes small and makes retention a drop, not a delete.
- Use UUIDv7-style keys when you need ordered inserts without a central counter.
- Batch writes where the domain allows it.
- Watch autovacuum — it is part of your capacity plan.
Key takeaways
- Measure index cost on the write path.
- Partition by a key you actually query.
- Vacuum is a first-class operational concern.