Ch. 10 · Microservices

Microservice Data Ownership and Shared Databases

Microservice Data Ownership and Shared Databases. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readbeginnerupdated Oct 3, 2026

Independent ownership requires controlling writes and schema evolution. A shared database can silently couple services even when HTTP interfaces look separate.

Before you start

You should understand HTTP, database transactions and the difference between one process and independently failing services. Draw the participants and message direction before choosing a pattern. Include timeout, duplicate delivery and recovery in the model instead of considering only successful requests.

The practical goal is to reason through this situation: The billing service owns invoice updates and publishes a supported interface. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: Name the authoritative owner

Assign invoice rules and writes to billing.

Step 2: Expose supported access

Use an API or replicated read model for other services.

Step 3: Define freshness and evolution

Document lag and version compatibility rather than sharing unrestricted SQL access.

Worked scenario

The billing service owns invoice updates and publishes a supported interface.

An order service directly updates billing’s invoice table to mark a refund. It bypasses billing validation and becomes coupled to billing’s schema release. A supported refund operation preserves ownership; a replicated dashboard view serves reads without pretending to be an authorized write path.

Common mistake

Directly editing another service’s tables bypasses its validation and release contract.

Verify the behavior

Change the owner’s schema and verify consumers continue through the supported contract.

Interview exercise

Read another service’s data.

Answer and reasoning

Use an API or replicated read model with defined freshness, rather than unrestricted cross-service writes.

Continue learning

Compare the scenario with the Microservices interview questions and test your understanding with the Microservices MCQs. For terminology and implementation details, consult the reference material.

More in Microservices

read ✓Microservices · hard

Microservices Anti-Corruption Layer

Protect a service's domain model from a foreign or legacy model with a translation layer at the boundary.

~2 min readread →
read ✓Microservices · hard

Microservices API Versioning and Evolution

Evolve service APIs without breaking consumers using additive changes, explicit versioning and consumer-driven contracts.

~2 min readread →
read ✓Microservices · hard

Microservices Backend for Frontend

Use a per-client BFF to aggregate services and shape responses, without letting it become a shared god service.

~2 min readread →
esc