The database-per-service pattern means each microservice owns and exclusively accesses its own database, rather than sharing a single database across services.
An Order Service using PostgreSQL and a Product Catalog Service using MongoDB can each pick the database best suited to their access patterns, and a schema change in the Order Service's tables never risks breaking the Catalog Service.
# order-service/application.yml: its own relational database
spring:
datasource:
url: jdbc:postgresql://orders-db:5432/orders
username: orders_app
# catalog-service/application.yml: a different database, chosen for its needs
spring:
data:
mongodb:
uri: mongodb://catalog-db:27017/catalog
# The Order service never connects to catalog-db. If it needs product data,
# it calls the Catalog API or keeps a copy updated from Catalog events.A concise interview answer is
Separate databases per service keep services truly independent — no shared schema means one team can change or scale their database without coordinating with others, and it limits the blast radius of a security or data issue to a single service. The cost is that queries spanning multiple services need patterns like sagas or API composition instead of a simple join.
Last updated: 1 November 2026
Previous question: How does Service Discovery help in the horizontal scaling of microservices?
Next question: What are the challenges of managing multiple databases in a microservices architecture?