Abstract
A query-result cache kept consistent from a database's change stream applies a committed change in place when it can only remove rows from a cached result, and invalidates the cached query when it could add rows the cache may not hold. For an inner join an insert into either table is structurally a possible addition, so every insert into a parent table invalidates every cached join over it. This disclosure describes three uses of declared integrity constraints and of subquery completeness that prove, at the stream position of the event, that a result cannot grow, so the change is applied in place. First, an insert into a relation whose join columns form a unique key referenced by a validated foreign key from every partner column cannot have partners among committed rows, so the join result is unchanged; the cache's contents cannot establish this, because population loads only rows that survived the join, and an origin lookup cannot, because it observes a later state. Second, when a query's only multi-table element is an uncorrelated subquery whose source tables are loaded in full and maintained exactly, an outer row entering the result has its membership decided over the cache and is upserted in place. Third, the same facts make the referencing side of an inner join complete for its own predicates and therefore a valid parent for constraint-containment reuse.
Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 License.
Recommended Citation
Nelson, James, "Avoiding Invalidation of Cached Inner-Join and Subquery Results on Change Events Using Declared Integrity Constraints and Fully Loaded Subquery Sets", Technical Disclosure Commons, ()
https://www.tdcommons.org/dpubs_series/13550