1 / 6

Yannakakis’ Algorithm

Yannakakis’ Algorithm. Semijoin . Let R, S, T and U be relations: R(A,B,C) S(C,D) T(D,E) U(E,F) Are the following always equivalent? Contained?. R  (S  (T  U)) and R  ((S  T)  U). (R  S)  (T  U) and R  (S  (T  U)). Contains.

donald
Download Presentation

Yannakakis’ Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Yannakakis’ Algorithm

  2. Semijoin  Let R, S, T and U be relations: R(A,B,C) S(C,D) T(D,E) U(E,F) Are the following always equivalent? Contained? R (S (T  U)) and R ((S  T)  U) (R  S) (T  U) and R (S (T  U)) Contains Consider {R(a,b,c), S(c,d1), T(d2,e), U(e,f)} Contains Consider {R(a,b,c), S(c,d), T(d,e1), U(e,f)}

  3. Yannakakis’ Algorithm Problem: Compute a projection on Y of (R1  …  Rn) where R1,…,Rn are acyclic, that is there is an attribute connected tree. Solution: Reduce the data using , then “carry upwards” attributes in Y. Example: R1=AB, R2=BC, R3=CD, R4=AM, R5=MN, R6=NK, R7=MT Y=TDB AB   Stage 1: Reduction: UP and DOWN   AM BC      CD  MN  MT  NK

  4. Yannakakis’ Algorithm Problem: Compute a projection on Y of (R1  …  Rn) where R1,…,Rn are acyclic, that is there is an attribute connected tree. Solution: Reduce the data using , then “carry upwards” attributes in Y. Example: R1=AB, R2=BC, R3=CD, R4=AM, R5=MN, R6=NK, R7=MT Y=TDB • Stage 2: Upwards • Proceed from the leaves towards the root. • Consider a node after all its subtree was handled. • Perform the join of a child and a parent, and project on the parent’s attributes  Y. • The result is available by projecting Y from the root. • Can optimize, for example when joining the “last child” of the root.

  5. Yannakakis’ Algorithm Problem: Compute a projection on Y of (R1  …  Rn) where R1,…,Rn are acyclic, that is there is an attribute connected tree. Solution: Reduce the data using , then “carry upwards” attributes in Y. Y=TDB Example: R1=AB, R2=BC, R3=CDU, R4=AM, R5=MN, R6=NK, R7=MT TDB ABT AB Stage 2: Upwards (BCDABT) (AMTAB) AM T BC D Time Polynomial in (input + output)   MN (CDUBC)  MT Not needed CDU NK

  6. Yannakakis’ Algorithm RA 3 0 4 0 AS 0 1 0 2 AP 00 NA 5 0 6 0 AM 0 7 0 8 How many tuples are there in (NA  AM RA  AS  AP  AM)[R S N M]?

More Related