A single-service query reads data held by one service, but that service’s database may not efficiently support the query’s workload. The problem is not necessarily crossing service boundaries: a query can be difficult because it combines demanding search types, requires denormalized data, or must scale. section 13.1 section 13.1.2
Assess the operational trade-offs before optimizing the query:
- Additional indexes can improve query performance but add write overhead because inserts, updates, and deletes must maintain them. section 13.1.2
- Queries requiring many expensive joins can increase latency and database load; a denormalized, pre-joined schema can serve them in a query-optimized form. section 13.1.2
- A query needing relational, text, and geo search may be difficult to support alongside relational management operations in one database. section 13.1.2
Restaurant availability search
findAvailableRestaurants() filters for restaurants open at a requested delivery time, searches near the delivery address, and matches keywords against restaurant names, descriptions, and menu items. The high-volume hybrid query shares a service with lower-volume relational restaurant management. section 13.1.2
Figure 13.2 The Restaurant Service has two very different sets of requirements, which would be challenging to satisfy with a single database: low-volume restaurant management operations that maintain relational restaurant information, such as opening hours and menus, and a high-volume findAvailableRestaurants() query that is a blend of relational, text, and geo search.
Contrasts restaurant management operations with the high-volume hybrid search they must coexist with. section 13.1.2
