Bird
0
0

You created a materialized view but forgot to refresh it after base table changes. What will happen when you query it?

medium📝 Debug Q7 of 15
PostgreSQL - Views and Materialized Views
You created a materialized view but forgot to refresh it after base table changes. What will happen when you query it?
AYou get stale data from the last refresh
BYou get the latest data automatically
CThe query fails with an error
DThe materialized view refreshes automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand materialized view data freshness

    Materialized views do not update automatically; they show data from last refresh.
  2. Step 2: Query behavior without refresh

    Query returns stale data until REFRESH MATERIALIZED VIEW is run.
  3. Final Answer:

    You get stale data from the last refresh -> Option A
  4. Quick Check:

    Materialized view data = last refresh snapshot [OK]
Quick Trick: Always refresh materialized views after base data changes [OK]
Common Mistakes:
  • Expecting automatic update on query
  • Assuming query fails without refresh
  • Thinking refresh happens on select

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes