Repaso
EspaƱol
Databases & SQLIntermediateDB-43

What is a view, and how does a materialized view differ?

Options

  1. A view saves a query run on read; a materialized view saves a result (Correct option)
  2. A view is a copy of the database; a materialized view is its backup
  3. A view is always faster than a materialized view of the same query
  4. There is no difference between a view and a materialized view

Answer

A view stores a saved query that runs each time you read it; a materialized view stores the query result physically and must be refreshed

Why

A view is a saved SELECT with a name: SELECT * FROM active_customers. It stores no data; each read re-runs the query. It simplifies queries and can hide columns for security.

A materialized view stores the result on disk (like a cached table). Reads are fast, but data can be stale until you refresh it (REFRESH MATERIALIZED VIEW).

Use materialized views for heavy reports.

Remember

View = saved query. Materialized view = saved result.

Key terms

Practice this question in Repaso