CS FundamentalsHardProduct-company MCQ pattern
A trigger-based implementation of a materialized view manually re-runs the entire defining query and replaces all the materialized rows every time ANY relevant base table changes. What is the main inefficiency of this 'full refresh' approach compared to incremental view maintenance?
- A. Full refresh cannot be used for materialized views with aggregates
- B. Full refresh is only possible for views with a single base table
- C. There is no inefficiency; full refresh is always optimal
- D. Full refresh redoes the ENTIRE computation (potentially scanning and joining large base tables) even when only a tiny fraction of the underlying data actually changed, whereas incremental maintenance computes just the delta needed to update the existing materialized result
Correct answer: D. Full refresh redoes the ENTIRE computation (potentially scanning and joining large base tables) even when only a tiny fraction of the underlying data actually changed, whereas incremental maintenance computes just the delta needed to update the existing materialized result
Recomputing a whole materialized view from scratch is simple to implement but wastes enormous work when, say, only a single row changed out of millions; incremental maintenance tracks exactly what changed (insert/update/delete) and propagates only the necessary adjustment to the already-materialized result, which is far cheaper but considerably more complex to implement correctly, especially for views with joins and aggregates.
More DBMS and SQL questions
- R(City, Street, Zip) has FDs City,Street → Zip and Zip → City, with candidate keys {City,Street} and {Street,Zip}. Decomposing into…
- A relation R(City, Street, Zip) has FDs City, Street → Zip and Zip → City (candidate keys: {City, Street} and {Street, Zip}). Why is this…
- The 3NF synthesis algorithm (based on a minimal cover of functional dependencies) is guaranteed to always produce a decomposition that is…
- Table Products(pid, pname, category, price, stock) rows: (1, 'Pen', 'Stationery', 10, 100), (2, 'Notebook', 'Stationery', 50, 0), (3…
- A database stores timestamps in UTC and converts to local time only at the application layer. A query does WHERE createdat BETWEEN…
- A column price NUMERIC (arbitrary precision decimal) is compared against a literal using price = 19.99. Why is this generally SAFE from…