Overview
Polyglot persistence means picking storage per use case: PostgreSQL for orders, Redis for sessions, Elasticsearch for search, a time-series database for metrics, object storage for blobs. The benefit is fit; the cost is everything that comes with running more systems.
How it works
Keep one source of truth and derive the rest.
Service --write--> PostgreSQL (system of record)
| CDC / outbox events
+-------------+-------------+
v v v
Search index Redis cache Analytics store
Derived stores are disposable: if one is lost, rebuild it from the source by replaying changes.
A practical governance approach is a paved road. The platform team supports a short list of engines, for instance one relational database, one cache, one search engine and one object store, each with templates for backups, alerts and access control. Teams may choose outside the list only by owning the full operational cost. Pair this with data contracts between stores: say how fresh a derived store must be, who can rebuild it, and what happens to user-facing features while it is behind or unavailable.
Pitfalls
- Dual writes from application code, which fail partially and cause drift.
- Adopting a database for résumé reasons rather than a measured need.
- No owner or runbook for a store, so restores are untested.
- Joining data across stores in application code on the hot path.
Key takeaways
- Start with one general-purpose database and add engines only for proven needs.
- Make exactly one store authoritative per piece of data.
- Feed secondary stores from a log so they are rebuildable.
- Count operational cost, not only query performance.