Chase (algorithm): Difference between revisions

Content deleted Content added
Yobot (talk | contribs)
m WP:CHECKWIKI error fixes using AWB (11708)
rm sig
 
(15 intermediate revisions by 13 users not shown)
Line 1:
'''The Chasechase''' is a simple [[fixed-point iteration|fixed-point algorithm]] testing and enforcing implication of data dependencies in [[database|database systems]]. It plays important roles in [[database theory]] as well as in practice.
It is used, directly or indirectly, on an everyday basis by people who design databases, and it is used in commercial systems to reason about the consistency and correctness of a data design.{{citation needed|date=November 2012}} New applications of the chase in meta-data management and data exchange are still being discovered.
 
The Chasechase has its origins in two seminal papers of 1979, one by [[Alfred V. Aho]], [[Catriel Beeri]], and [[Jeffrey D. Ullman]]<ref>[[Alfred V. Aho]], [[Catriel Beeri]], and [[Jeffrey D. Ullman]]: "The Theory of Joins in Relational Databases", ACM Trans. Datab. Syst. 4(3):297-314, 1979.</ref> and the other by [[David Maier]], [[Alberto O. Mendelzon]], and [[Yehoshua Sagiv]].<ref>
[[David Maier]], [[Alberto O. Mendelzon]], and [[Yehoshua Sagiv]]: "Testing Implications of Data Dependencies". ACM Trans. Datab. Syst. 4(4):455-469, 1979.</ref>
 
In its simplest application the chase is used for testing whether the [[projection (relational algebra)|projection]] of a [[relation schema]] constrained by some [[functional dependency|functional dependencies]] onto a given decomposition can be [[join dependency|recovered by rejoining the projections]]. Let ''t'' be a tuple in <math>\pi_{S_1}(R) \bowtie \pi_{S_2}(R) \bowtie ... \bowtie \pi_{S_k}(R)</math> where ''R'' is a [[relation (database)|relation]] and ''F'' is a set of functional dependencies (FD). If tuples in ''R'' are represented as ''t<sub>1</sub>, ..., t<sub>k</sub>'', the join of the projections of each ''t<sub>i</sub>'' should agree with ''t'' on <math>\pi_{S_i}(R)</math> where ''i'' = 1, 2, ..., ''k''. If ''t<sub>i</sub>'' is not on <math>\pi_{S_i}(R)</math>, the value is unknown.
 
The chase can be done by drawing a tableau (which is the same formalism used in [[tableau query]]). Suppose ''R'' has [[attribute (computing)|attributes]] ''A, B, ...'' and components of ''t'' are ''a, b, ...''. For ''t<sub>i</sub>'' use the same letter as ''t'' in the components that are in S<sub>''i''</sub> but subscript the letter with ''i'' if the component is not in S<sub>''i''</sub>. Then, ''t<sub>i</sub>'' will agree with ''t'' if it is in S<sub>''i''</sub> and will have a unique value otherwise.
 
The chase process is [[confluence (rewriting system)|confluent]]. There exist implementations of the chase algorithm,<ref>[[Michael Benedikt (computer scientist)|Michael Benedikt]], [[George Konstantinidis]], [[Giansalvatore Mecca]], [[Boris Motik]], [[Paolo Papotti]], [[Donatello Santoro]], [[Efthymia Tsamoura]]: ''Benchmarking the Chase''. In Proc. of PODS, 2017.</ref> some of them are also open-source.<ref>{{cite web |url=https://github.com/donatellosantoro/Llunatic |title=The Llunatic Mapping and Cleaning Chase Engine|date=6 April 2021}}</ref>
The chase process is [[confluence (rewriting system)|confluent]].
 
==Example==
Let ''R''(''A'', ''B'', ''C'', ''D'') be a relation schema known to obey the set of functional dependencies ''F'' = {''A''→''B'', ''B''→''C'', ''CD→A''}. Suppose ''R'' is decomposed into three relation schemas S<sub>1</sub> = {''A'', ''D''}, S<sub>2</sub> = {''A'', ''C''} and S<sub>3</sub> = {''B'', ''C'', ''D''}. Determining whether this decomposition is lossless can be done by performing a chase as showshown below.
 
The initial tableau for this decomposition is:
Line 25:
|}
The first row represents S<sub>1</sub>. The components for attributes ''A'' and ''D'' are unsubscripted and those for attributes ''B'' and ''C'' are subscripted with ''i'' = 1. The second and third rows are filled in the same manner with S<sub>2</sub> and S<sub>3</sub> respectively.
 
The goal for this test is to use the given ''F'' to prove that ''t'' = (''a'', ''b'', ''c'', ''d'') is really in ''R''. To do so, the tableau can be chased by applying the FD’s in ''F'' to equate symbols in the tableau. Final tableau with a row that is the same as ''t'' implies that any tuple ''t'' in the join of the projections is actually a tuple of ''R''.
ToThe performgoal thefor chasethis test, firstis decomposeto alluse FD’sthe ingiven ''F'' soto eachprove FDthat has''t'' = (''a'', single''b'', attribute''c'', on''d'') is really in ''R''. To do so, the righttableau handcan sidebe ofchased by applying the "arrow".FDs in ''F'' remainsto unchangedequate becausesymbols allin ofthe itstableau. FD'sA final alreadytableau haswith a singlerow attributethat onis the rightsame hand side.as ''Ft'' =implies {''A''→''B'',that any tuple ''Bt''→''C'', in the join of the projections is actually a tuple of ''CD''→''AR''}.
<br />
When equating two symbols, if one of them is unsubscripted, make the other be the same so that the final tableau can have a row that is exactly the same as ''t'' = (''a'', ''b'', ''c'', ''d''). Also, if both have their own subscript, change either to be the other. However, to avoid confusion, all of the occurrences should be changed.
To perform the chase test, first decompose all FDs in ''F'' so each FD has a single attribute on the right hand side of the "arrow". (In this example, ''F'' remains unchanged because all of its FDs already have a single attribute on the right hand side: ''F'' = {''A''→''B'', ''B''→''C'', ''CD''→''A''}.)
First, apply ''A''→''B'' to the tableau. The first row is (''a'', ''b<sub>1</sub>'', ''c<sub>1</sub>'', ''d'') where ''a'' is unsubscripted and ''b<sub>1</sub>'' is subscripted with 1. Comparing the first row with the second one, change ''b<sub>2</sub>'' to ''b<sub>1</sub>''. Since the third row has ''a<sub>3</sub>'', ''b'' in the third row stays the same. The resulting tableau is:
 
When equating two symbols, if one of them is unsubscripted, make the other be the same so that the final tableau can have a row that is exactly the same as ''t'' = (''a'', ''b'', ''c'', ''d''). Also, ifIf both have their own subscript, change either to be the other. However, to avoid confusion, all of the occurrences should be changed.
<br>
First, apply ''A''→''B'' to the tableau.
First, apply ''A''→''B'' to the tableau. The first row is (''a'', ''b<sub>1</sub>'', ''c<sub>1</sub>'', ''d'') where ''a'' is unsubscripted and ''b<sub>1</sub>'' is subscripted with 1. Comparing the first row with the second one, change ''b<sub>2</sub>'' to ''b<sub>1</sub>''. Since the third row has ''a<sub>3</sub>'', ''b'' in the third row stays the same. The resulting tableau is:
{| border="1" cellspacing="0" cellpadding="5" align="center"
! ''A'' !! ''B'' !! ''C'' !! ''D''
Line 68 ⟶ 73:
* [[Jeffrey Ullman|J. D. Ullman]]: ''Principles of Database and Knowledge-Base Systems, Volume I''. Computer Science Press, New York, 1988.
* [[Jeffrey Ullman|J. D. Ullman]], [[Jennifer Widom|J. Widom]]: ''A First Course in Database Systems'' (3rd ed.). pp.&nbsp;96–99. Pearson Prentice Hall, 2008.
* [[Michael Benedikt (computer scientist)|Michael Benedikt]], [[George Konstantinidis]], [[Giansalvatore Mecca]], [[Boris Motik]], [[Paolo Papotti]], [[Donatello Santoro]], [[Efthymia Tsamoura]]: ''Benchmarking the Chase''. In Proc. of PODS, 2017.
 
== Further reading ==