Bird
0
0

You have a large sales table updated daily. You want to create a summary view that is fast to query but updated only once a day. Which is the best approach?

hard📝 Application Q8 of 15
PostgreSQL - Views and Materialized Views
You have a large sales table updated daily. You want to create a summary view that is fast to query but updated only once a day. Which is the best approach?
ACreate a regular view and refresh it manually daily.
BCreate a regular view and query it directly for real-time data.
CCreate a materialized view and refresh it daily after updates.
DCreate a materialized view and never refresh it.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze performance and update frequency needs

    Large tables with daily updates benefit from precomputed summaries for fast queries.
  2. Step 2: Choose materialized view with scheduled refresh

    Materialized views store results and can be refreshed once daily to balance freshness and speed.
  3. Final Answer:

    Create a materialized view and refresh it daily after updates. -> Option C
  4. Quick Check:

    Best for daily update and fast query = A [OK]
Quick Trick: Materialized views with scheduled refresh optimize large data queries [OK]
Common Mistakes:
  • Using regular views for large data causing slow queries
  • Not refreshing materialized views causing stale data
  • Assuming regular views can be refreshed manually

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes