What is a database materialized view?
Short answer: A materialized view is a database object that stores the results of a query physically, unlike a regular view, which computes its result dynamically.
Explain a bit more
Advantages: Faster query response times as the results are precomputed and stored. Can be refreshed periodically (e.g., every hour or after specific events) to keep the data up to date. Use cases: Reporting, data warehousing, and aggregation-heavy applications. Example: A materialized view could aggregate sales data by day, allowing a query to retrieve the precomputed values instead of performing costly aggregation on the fly.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png