Is it ever acceptable for one microservice to read directly from another microservice's database tables as a shortcut?
In general, no — this is considered a serious anti-pattern in microservices design, even though it looks like a fast, easy fix. The moment one service can reach directly into another's tables, the schema is no longer private, which means the owning team can no longer change it freely without breaking a hidden dependency they may not even know exists. It also re-couples the two services' scaling and availability: a slow query or an outage in one service's database can now degrade a completely unrelated service that only happens to share the same physical database. The correct approach is for the service that needs data it doesn't own to go through the owning service's API — accepting the cost of a network call in exchange for keeping ownership, and the benefits that come with it, genuinely intact.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response