Skip to content

6.4. Data Management Patterns

The rule that gives microservices their independence — each service owns its own database — is also the rule that takes away joins, transactions, and easy cross-service queries. A shared database quietly recouples the services you worked to separate; keeping databases private forces you to solve querying and consistency at the application layer. This chapter covers database-per-service, why the shared-database anti-pattern is so tempting and so dangerous, and the composition, polyglot-persistence, and materialized-view patterns that answer “how do I query data I don’t own?”