Why is the 'database-per-service' pattern recommended, and what are the challenges when you need to join or query across data owned by different services?
Last updated
Database-per-service means each service exclusively owns its data. This enables loose coupling, independent schema changes and scaling, and clear API-only contracts.
Challenges: no cross-service JOINs, no distributed ACID transactions, and harder cross-service reporting.
Teams cope with API Composition for small real-time queries, CQRS read models for complex ones, Sagas (sequences of local transactions) for consistency, and event streams into a data warehouse for analytics.
- https://dev.to/cathylai/why-every-microservice-should-have-its-own-database-jc0
- https://microservices.io/patterns/cn/data/database-per-service.html
- https://dev.to/sasidhar_gadepalli/top-10-microservice-architecture-design-patterns-for-developers-dgk
- https://github.com/rahul3355/regulated-enterprise-ai-engineering-handbook/blob/main/interview-prep/backend-interview-questions.md
- https://github.com/nomemory/java-interview-questions
- https://stackoverflow.com/questions/43612866/microservices-with-shared-database-using-multiple-orms
- https://stackoverflow.com/questions/42281634/application-side-join-orm-for-node
- https://dev.to/dishitdevasia/the-ultimate-guide-to-the-evolution-of-microservices-48o3