If a live dashboard needs to reflect balances across multiple services in near real time, which combination of patterns would you reach for, and why?
A materialized view combined with a subscription query is the right pair here. The materialized view combines events from every relevant service — accounts, loans, cards — into one denormalized, purpose-built read model designed specifically for this dashboard, avoiding the need to query across service boundaries at read time or stitch together several services' responses on every page load. A subscription query layered on top of that materialized view then pushes fresh results to the dashboard automatically the instant any of the underlying events update the view, instead of forcing the client to poll repeatedly for changes. Together, this gives a dashboard that's both fast to query (thanks to the materialized view doing the cross-service combination work ahead of time) and live-updating (thanks to the subscription query pushing changes as they happen), without any bespoke real-time infrastructure beyond what the projection and event-processing pipeline already provide.
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