Difference view and Materialized view in Oracle SQL PLSQL.
"This is excepted question in interview. It is asked in technical support ,PLSQL developer, SQL Analyst and developer."
INTRODUCTION:
QUERY:
DIFFERENCE:
VIEW: |
Materialized View: |
It is slower than the materialized view. |
It is faster than the view. |
When we will update the base table, there is no need
refresh it. |
When we will update the base table, there is need to
manual refresh it. Refreshing technique is used to refresh the materialized
view’s temporary table. |
Syntax: Create view view_name AS SELECT columns FROM
TABLES [WHERE CONDITIONS]; |
Syntax: Create Materialized view_name AS SELECT columns FROM TABLES [WHERE conditions]; |
Here, view is the keyword. |
Here, materialized is the keyword. |
It contains the select SQL statement. |
It contains the data or output of the select statement. |
It is not required the space for holding the data. |
It is required the space for holding the data. |
If the base table is dropped, then also the view will
not be accessible. |
If the base table is dropped, then also it will
be accessible. |
DML operations can directly performed. |
DML operations cannot be directly performed. |
It does not store the data, but it stores the SQL
query. |
It stores the data and query. |
Base table dependency doesn't on the other tables, then
it is preferred to use the view. |
Base table dependency is on the other tables, then it
is preferred to use the materialized view. |
Refresh activity does not take place. |
Refresh activity takes place. It stores the data of the remote table which is called snapshot. Snapshot is the older form of materialized view which is used in the data warehouse. |
It fetches the latest data from the base table. |
It does not fetch the latest data from
the base table, it fetches the data from the physical table. |
Any change in the base table data will reflect in the
view immediately. |
Any change in the base table ‘s data will not reflect
in the materialized view immediately. |
It is called as the online data retrieved from base
tables. |
It is called as the offline data or delay data
retrieved from base tables. |
It retrieves the data from the base table. |
It retrieves the data from the materialized table which
need to be manually updated through refresh from the underlying base tables. |
It is used in the simple queries. |
It is used in the complex queries. |
Indexing cannot be applied. |
Indexing can be applied. |
Performance is slow for select queries. |
Performance is fast for select queries |
Maintenance or updating cost don't occur. |
Maintenance or updating cost occur. |
When the table's data is updated frequently and its
access infrequently. |
When the table's data is updated infrequently and its
access frequently. |
It is dynamic because it will show the updated data. |
It is static because it will show the updated data
after last refresh. |
Storage cost is present. |
Storage cost is not present. |
Execution of automatic action method or trigger to
refresh is not required. |
Execution of automatic action method or trigger to refresh is required. |
Don't require the physical copy of the database. |
It requires the physical copy of the database. |
Execution of the query will provide result or output
which is not stored in the disk or the database. |
Execution of the query will provide result or output
which is stored in the disk or the database. |
It is designed with fixed architecture approach for
defining with sql standard. |
It is designed with generic architecture approach for
not defining with sql standard. |
Row id is similar with the original table. |
Row id is entirely different with the original table. |
Comments
Post a Comment