Oracle Views vs Materialized views
Oracle database has various objects like tables, Triggers, views ,Materialized views.
This has information on oracle views vs materialized views.
Views | Materialized Views |
---|---|
View is a logical table based on one or more tables or views. | Materialized view is a replica of a target table
from a single point in time. |
A view contains no data itself. | Materialized view contains data also |
The tables upon which a view is based are called base tables. | Materialized views are updated from the target
table through individual batch updates, known as a refreshes. |
Example: CREATE VIEW emp_view AS SELECT last_name, salary*12 annual_salary FROM employees WHERE department_id = 20; |
Example: CREATE MATERIALIZED VIEW MV_employees BUILD IMMEDIATE REFRESH FORCE ON DEMAND AS SELECT * FROM hr.employees@orcl.example.com; |
Drop view emp_view; | DROP MATERIALIZED VIEW MV_EMPLOYEES; |
select view_name, text from USER_VIEWS where view_name=’EMP_VIEW’ ; | select MVIEW_NAME,QUERY
from USER_MVIEWS where MVIEW_NAME=’MV_EMPLOYEES’; |
Reference: https://docs.oracle.com/cd/B28359_01/server.111/b28286 | Reference: https://docs.oracle.com/cd/B28359_01/server.111/ |
0 responses on "Oracle Views vs Materialized views"