You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Enhancement] Judge a base table column change by the binding an MV query was built with, not by the names it reads #68841
#68646 judges whether a base table column change reaches a materialized view by re-analysing the view's stored query and asking whether it reads a column of that name. That is a name-level reading of the plan the change left, and it is wrong in both directions: it misses a binding that moved into a name the view now answers for itself, and it invalidates a view for a name whose binding could not have moved. Every counterexample found in review is one of those two, and fixing one side has moved the reading to the other (measured: widening the alias branch so the first case below is caught puts the first needless invalidation back).
Both lists below are the same question asked of the plan after the change -- which column does this name read, before and after -- which the analysed plan does not answer on its own.
Missed invalidations (the view stays NORMAL holding rows the query no longer returns)
A name that moved into an alias over another table's column: EXISTS (SELECT b.x AS flag, COUNT(*) n FROM changed_t c JOIN other_t b ON b.id = c.id WHERE c.id = o.id GROUP BY b.x, flag HAVING flag = 1)
After a light DROP changed_t.flag the query returns a row the view does not hold, while the view stays NORMAL and in sync (measured: #4219437313).
A predicate an enclosing EXISTS ignores: a scalar subquery's filter, and a projection an EXISTS never compares (#4214302759, #4225713078).
ORDER BY resolving the output alias before the column of the same name (#4214302771).
An explicitly qualified reference to another table's column of the same name (#4214302779).
Directions (none chosen here)
Store the binding with the view: a fingerprint of what each name resolved to when the view was built (persisted, written at creation and each refresh), compared against the plan the change left.
Activity
[improvement](mtmv) Judge a base table column change by the MV query …