 |
|
ss
Oracle Tips by Burleson |
Materialized Views
Materialized views (Mview) are very much
like a regular Oracle table, except that they are based on one or
more tables. They can be simple or complex, read only, or
updatable. Because an Mview is a physical table, changes are
managed by updating the effected rows in the Mview when the
underlying tables change. Updating an Mview is called refreshing
it. There are two types of refresh: fast and full.
In a full refresh, the Mview is truncated
and rebuild from the underlying tables. In a fast refresh, only the
changes are updated in the Mview. A forced refresh tells the Mview
to try and execute a fast refresh, and if that fails, execute a full
refresh. In order to execute a fast refresh, the underlying tables
must have a materialized view log. This log records changes to the
table so that the Mview can retrieve them.
Mviews are normally used to aggregate
information in a data warehouse database. They can also be used in
replicating data from one database to another. Unlike normal views,
INSERTs/UPDATEs/DELETESs of Mview require implementing advanced
replication, which is far beyond the scope of this book. The Mview
can be writable, which allows the data to be modified; however, the
changes are not propagated back to the underlying tables and are
lost when the Mview refreshes.
The above book excerpt is from:
Easy Oracle
SQL
Get Started
Fast writing SQL Reports with SQL*Plus
ISBN 0-9727513-7-8
John Garmany
http://www.rampant-books.com/book_2005_1_easy_sql.htm |