Bird
0
0

Why does PostgreSQL require INSTEAD OF triggers to update views with joins or aggregates?

hard📝 Conceptual Q10 of 15
PostgreSQL - Views and Materialized Views
Why does PostgreSQL require INSTEAD OF triggers to update views with joins or aggregates?
ABecause aggregates require recalculating indexes.
BBecause the database cannot automatically map updates to multiple underlying tables.
CBecause INSTEAD OF triggers improve query performance.
DBecause views with joins are always read-only by design.
Step-by-Step Solution
Solution:
  1. Step 1: Understand view update complexity

    Views with joins or aggregates combine data from multiple tables or summarize data.
  2. Step 2: Reason about update mapping

    PostgreSQL cannot guess how to update multiple tables or aggregated data automatically.
  3. Final Answer:

    Because the database cannot automatically map updates to multiple underlying tables. -> Option B
  4. Quick Check:

    Complex views need triggers for update mapping [OK]
Quick Trick: Triggers map complex view updates to base tables [OK]
Common Mistakes:
  • Thinking joins are always read-only by design
  • Assuming triggers improve performance only
  • Confusing aggregates with index recalculation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes