What's the actual difference between View and Materialized View?
I have gone through lot of links where they said normal View is a like a virtual table and data cannot be stored on a disk where in case materialized data will get stores on the disk. But from there I'm getting nothing like when to use normal view and when to use Materialized view. If I create both the views I can see in my schema. I want to know exact when and where we use the normal view and we use materialized view. Please provide me the solution with practical example.
Thanks
A view is just a stored query. It's a handy way of saving some complicated business logic (joins, filters, derived values) so it can be reused and shared with other users.
A materialized view is also a way of saving a query but it materializes the result set. That is, it creates a copy of the data on disk.
The main reason for using a materialized view is improved performance. Every time we select from a view we execute the whole query; if it's an expensive query that's a cost we pay each time. With a materialized view we trade disk space for time.
Furthermore, we can treat a materialized view like a table: we can index them, we can add key constraints, we can even reference them in a foreign key.
The main reason not to use a materialized view is cost. They take up disk space. They also have to be maintained. By default materialized views are static, which means their data gradually becomes stale over time. Refreshing a materialized view can be burdensome (depending on the underlying query). Whereas querying a view always gives us the most up-to-date view of the data.
The following are only guidelines, and neither complete or distinct
When to use a view
When to use a materialized view
The answers to your questions are in the documentation(*). I have no intention of rewriting that fine manual but I will address your questions because having started I am condemned to continue.
select * from user_extents where segment_name = 'name of mview'
(*) This is Oracle's documentation because that's what your profile suggests but other RDBMS platforms have similar docs.