Recall & Review
beginner
What is a regular view in PostgreSQL?
A regular view is a saved SQL query that acts like a virtual table. It does not store data itself but shows data from underlying tables when queried.
Click to reveal answer
beginner
What is a materialized view in PostgreSQL?
A materialized view stores the result of a query physically. It saves data on disk and must be refreshed to update its content.
Click to reveal answer
intermediate
When should you choose a materialized view over a regular view?
Choose a materialized view when the query is complex and slow, and the data does not need to be real-time. It improves performance by storing precomputed results.
Click to reveal answer
intermediate
What is a downside of using materialized views?
Materialized views require manual or scheduled refresh to update data, so they can show outdated information if not refreshed regularly.
Click to reveal answer
beginner
How does a regular view handle data updates?
A regular view always shows the latest data from the underlying tables because it runs the query fresh each time it is accessed.
Click to reveal answer
Which of the following stores data physically in PostgreSQL?
✗ Incorrect
Materialized views store query results physically, unlike regular views which are virtual.
What must you do to update data in a materialized view?
✗ Incorrect
Materialized views require a manual refresh command to update their stored data.
Which view type always shows the most current data?
✗ Incorrect
Regular views run the query each time, so they always show current data.
When is it better to use a regular view instead of a materialized view?
✗ Incorrect
Regular views are better for frequently changing data that needs to be up-to-date.
What is a main benefit of materialized views?
✗ Incorrect
Materialized views improve performance by storing precomputed results.
Explain the key differences between a materialized view and a regular view in PostgreSQL.
Think about storage and data freshness.
You got /4 concepts.
Describe scenarios when you would choose a materialized view over a regular view.
Consider performance and data update frequency.
You got /4 concepts.