Algorithm Search⌘K

Definitionadvanced

Self-maintainable view

Also called self-maintainability.

A materialized view that can be updated from its old contents and the base changes alone, without reading the base relations.

A self-maintainable view is a materialized view whose new contents after a change to the base relations are a function of its old contents and the change, so that maintenance never reads the base relations. It is a property of the view definition together with a kind of change (insertions, deletions or both) and the integrity constraints, not of an algorithm. Delta rules give the change of any view but usually read the old base relations, and deferred view maintenance asks a related question about when the base relations are read.

Definition

Let L\mathcal{L} be the set of legal databases (those that satisfy the constraints), and let C\mathcal{C} be a class of changes, for example the insertions into relation RR. Write D+ΔD + \Delta for the database after the change Δ\Delta. A view VV is self-maintainable for C\mathcal{C} if, for all D1,D2∈LD_1, D_2 \in \mathcal{L} and every Δ∈C\Delta \in \mathcal{C} such that D1+ΔD_1 + \Delta and D2+ΔD_2 + \Delta are legal,

V(D1)=V(D2)  ⟹  V(D1+Δ)=V(D2+Δ).V(D_1) = V(D_2) \implies V(D_1 + \Delta) = V(D_2 + \Delta).

Equivalently, there is a function FF with V(D+Δ)=F(V(D),Δ)V(D + \Delta) = F(V(D), \Delta) for every legal DD and every applicable Δ∈C\Delta \in \mathcal{C}. The first form is the one that refutes self-maintainability: two databases with the same view and the same change that give different new views are a proof that no FF exists.

A set of views {V,A1,…,Ak}\{V, A_1, \ldots, A_k\} is self-maintainable if the tuple of all their contents is: each new view is a function of the old contents of all of them and the change. The AiA_i are auxiliary views. Their base case is the set of all base relations, which is always self-maintainable; the aim is to choose auxiliary views that are much smaller.

The answer depends on three choices: the class of changes, the semantics (sets or bags), and the constraints in L\mathcal{L}. Keys and foreign keys, written as a functional dependency and an inclusion dependency, make L\mathcal{L} smaller, so fewer pairs D1,D2D_1, D_2 must agree and more views qualify.

Examples and non-examples

R(A,B)R(A, B) and S(B,C)S(B, C) are base relations. Each "no" row gives a pair of databases that refutes the property.

view change semantics self-maintainable reason or counterexample
σA>0(R)\sigma_{A > 0}(R) insert or delete in RR sets or bags yes ΔV=σA>0(ΔR)\Delta V = \sigma_{A > 0}(\Delta R)
πA(R)\pi_A(R) insert in RR sets yes add πA(ΔR)\pi_A(\Delta R)
πA(R)\pi_A(R) delete in RR sets no R1={(1,1),(1,2)}R_1 = \{(1, 1), (1, 2)\} and R2={(1,1)}R_2 = \{(1, 1)\} both give {1}\{1\}; deleting (1,1)(1, 1) gives {1}\{1\} and ∅\emptyset
πA(R)\pi_A(R) insert or delete in RR bags yes the counts of the view are the counts of derivations, and ΔV=πA(ΔR)\Delta V = \pi_A(\Delta R)
R⋈SR \bowtie S insert in RR sets or bags no R=∅R = \emptyset with S={(10,x)}S = \{(10, x)\} or S=∅S = \emptyset gives the empty view; inserting (1,10)(1, 10) gives one tuple or none
R⋈SR \bowtie S delete in RR sets yes remove the view tuples whose A,BA, B part is the deleted tuple
R⋈SR \bowtie S delete in RR bags no R={(1,10)},S={(10,x),(10,x)}R = \{(1, 10)\}, S = \{(10, x), (10, x)\} and R={(1,10),(1,10)},S={(10,x)}R = \{(1, 10), (1, 10)\}, S = \{(10, x)\} both give (1,10,x)(1, 10, x) twice; deleting one (1,10)(1, 10) gives 0 copies and 1 copy
R⋈SR \bowtie S, with BB a key of SS and R.BR.B a foreign key to SS insert in SS sets or bags yes a new tuple of SS has a new key, which no tuple of RR references, so ΔV=∅\Delta V = \emptyset
γG; MAX(X)(R)\gamma_{G;\, \mathrm{MAX}(X)}(R) insert in RR bags yes the new maximum is the larger of the old one and the inserted value
γG; MAX(X)(R)\gamma_{G;\, \mathrm{MAX}(X)}(R) delete in RR bags no groups {5,3}\{5, 3\} and {5}\{5\} both give 5; deleting 5 gives 3 and no group
γG; SUM(X)(R)\gamma_{G;\, \mathrm{SUM}(X)}(R) delete in RR bags no groups {2,0}\{2, 0\} and {2}\{2\} both give 2; deleting 2 gives 0 and no group
γG; SUM(X),COUNT(∗)(R)\gamma_{G;\, \mathrm{SUM}(X), \mathrm{COUNT}(*)}(R) insert or delete in RR bags yes both are sums over the group, and a count of 0 says the group is gone

The join and auxiliary views. R⋈SR \bowtie S is not self-maintainable for insertions into RR, because the inserted tuple must meet tuples of SS that the view may not show. Under set semantics, the set {R⋈S,A}\{R \bowtie S, A\} with the auxiliary view A=SA = S is self-maintainable for insertions and deletions in RR and for deletions from SS, at the cost of storing AA. It is still not self-maintainable for insertions into SS: a tuple of RR with no match is in neither view, and a new tuple of SS can match it. Quass, Gupta, Mumick and Widom derive such auxiliary views from the view definition, push the selections of the view into them, and use keys and referential integrity to drop the auxiliary views that the constraints make unnecessary, as in the foreign key row of the table.

Bags change the answer. The set projection fails for deletions and the bag projection does not, because the bag view holds the count that the set view lost. The bag join fails for deletions and the set join does not, because in a bag the count of a view tuple is a product of two base counts that the view cannot split.

  • Delta rules give ΔV\Delta V for any view. A view is self-maintainable for a class of changes when its delta rules can be rewritten to read only VV and Δ\Delta.
  • Incremental view maintenance is the algorithm that applies the delta. In a data warehouse the base relations are at remote sources, and a self-maintainable view, with its auxiliary views, can be maintained without queries to the sources.
  • Deferred view maintenance keeps logs of the base changes and refreshes later. A self-maintainable view needs only the logs, not the current base state.
  • View selection chooses which views to materialize. The auxiliary views of a self-maintainable set are a choice of this kind, with maintenance cost in place of query cost.
  • In a stream system, a view that is self-maintainable for insertions can take a late tuple at any time, because the change needs no old base data. A view that is not must keep the base data, or a summary of it, for as long as late data can arrive.
  • An autonomously computable update, in the sense of Blakeley, Coburn and Larson, is the same idea for one given update and one given view contents, not for all databases.

References

  1. Data integration using self-maintainable views, the definition of a view that is self-maintainable for a kind of change, and the conditions for select-project-join views (general locator, pages not checked)
  2. Dallan Quass, Ashish Gupta, Inderpal Singh Mumick and Jennifer Widom, Making views self-maintainable for data warehousing, Proceedings of PDIS 1996, pages 158 to 169, the auxiliary views that make a view and its helpers self-maintainable together, and the use of keys and referential integrity to make the auxiliary views small
  3. Updating derived relations, detecting irrelevant and autonomously computable updates, the updates that can be applied to a derived relation from its contents and the update alone (general locator)
  4. Maintenance of materialized views, problems, techniques, and applications, the classification of maintenance problems by the information that is available, with the view and the change alone as the smallest case

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/0XB7XD/text.yaml