DEV Community

Heron Rossi
Heron Rossi

Posted on

Explain: Oracle Materialized View like Im five

Top comments (2)

Collapse
 
databasesponge profile image
MetaDave πŸ‡ͺπŸ‡Ί • Edited

A database table is two things: a set of metadata about columns (name, type), and segments that store data.

A database view is two things: a set of metadata about columns (name, type), and a query that generates data when you select from the view.

A materialized view is four things: a set of metadata about columns (name, type), a query that generates the data, segments that store the data that is the result of executing the query, and further metadata that control the maintenance of the data (refresh mechanisms) and the data's staleness.

All of these are a "relation" -- a set of rows and columns that you can select or (sometimes) modify.

Views have no data storage, and the data is generated on demand.

Materialized views store the result of the query, and can have the ability to keep themselves synchronised with the underlying data so that the base query does not have to be re-executed for the data to be accessed.

Collapse
 
heronrs profile image
Heron Rossi

Very nice! Thanks for the explanation :)