Bird
0
0

Given a materialized view mv_products created from a products table, what will be the result of running REFRESH MATERIALIZED VIEW mv_products; after adding new rows to the products table?

medium📝 query result Q13 of 15
PostgreSQL - Views and Materialized Views

Given a materialized view mv_products created from a products table, what will be the result of running REFRESH MATERIALIZED VIEW mv_products; after adding new rows to the products table?

AThe materialized view will remain unchanged and exclude new rows.
BThe command will delete the materialized view.
CThe materialized view will include the new rows after refresh.
DThe command will cause a syntax error.
Step-by-Step Solution
Solution:
  1. Step 1: Understand materialized view behavior

    Materialized views store snapshot data and do not update automatically when base tables change.
  2. Step 2: Effect of REFRESH MATERIALIZED VIEW

    Running REFRESH updates the stored data to include all current rows, including newly added ones.
  3. Final Answer:

    The materialized view will include the new rows after refresh. -> Option C
  4. Quick Check:

    REFRESH updates view data to current table data [OK]
Quick Trick: Refresh syncs materialized view with current table data [OK]
Common Mistakes:
  • Assuming materialized views auto-update without refresh
  • Thinking refresh deletes the view
  • Expecting syntax errors from correct command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes