Download presentation
1
Materialized views (snapshot tables)
Using Oracle Materialized views
2
Ordinary views vs. materialized views
Virtual table Named select statement Part of the SQL standard Syntax CREATE VIEW viewName AS selectStatement Physical table Replication of master data at a single point in time Not part of the SQL standard Syntax CREATE MATERIALIZED VIEW viewName AS selectStatement Materialized views
3
Why use materialized views?
Replicate data to non-master sites To save network traffic when data is used in transactions Cache expensive queries Expensive in terms of time or memory Example: Sum, average or other calculations on large amounts of data Materialized views
4
Refreshing a materialized view
Refresh types Complete refresh Recreates the materialized view Fast refresh Only changed data is refreshed Initiating a refresh Scheduled refresh On-demand refresh execute DBMS_REFRESH.REFRESH('hr_refg') Materialized views
5
Different kinds of materialized views
Read-only Insert, update or delete NOT allowed Updateable Insert, update and delete on the view is allowed Changes made to the view are pushed back to the master tables at refresh SQL syntax CREATE MATERIALIZED VIEW viewName FOR UPDATE AS aSelectStatement Writeable Changes made to the view are NOT pushed back to the master tables at refresh Same as updateable. The difference lies in the definitio of “refresh groups” … Materialized views
6
References and further reading
Oracle9i Advanced Replication Release 2 (9.2) 3 Materialized View Concepts and Architecture Oracle® Database SQL Reference 10g Release 2 (10.2) CREATE MATERIALIZED VIEW Materialized views
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.