Back to Catalog
Microservices
Data Management
Shared Database
Multiple services share one DB — easy joins, tight coupling. An anti-pattern at scale.
Intent & Description
Real-world Use Case
Legacy system has 5 “microservices” all hitting the same MySQL schema. Order table is referenced by 4 services. Changing a column requires coordinating all 4 teams. This is the shared database anti-pattern in the wild.
Source
📌 TL;DR
Shared Database is the microservice anti-pattern. Easy to start, painful to live with. Migrate to Database per Service as fast as your team can manage.
Advantages
- Simple to implement initially
- Easy cross-service JOINs — data consistency is trivial
- ACID transactions across all services
- No need for Saga or eventual consistency patterns
Disadvantages
- Schema changes require coordinating all services simultaneously
- One service can degrade DB performance for all others
- Tight coupling — services can’t be deployed independently if schema changes
- Prevents polyglot persistence — all services locked to same DB tech
- Kills true microservice independence