1 / 12

9. Evaluation of Queries

9. Evaluation of Queries. Query evaluation –. 9.1 Quantifier Elimination and Satisfiability Example: Logical Level: r   y 1 ,…y n  r’ Constraint level: S  eliminate x  S’

Download Presentation

9. Evaluation of Queries

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. 9. Evaluation of Queries Query evaluation –

  2. 9.1 Quantifier Elimination and Satisfiability Example: Logical Level: r  y1,…yn  r’ Constraint level: S  eliminate x  S’ Infinite relation r(x, y1,…yn) equivalent to constraint relation S. Infinite relation r’(y1,…yn) equivalent to constraint relation S’. Quantifier elimination – S’ = x S– S’ is equivalent to eliminating x from S Closed quantifier elimination – when S’ and S have the same type of constraints.

  3. QE is closed for conjunctions of: • Infinite domain equality and inequality • Rational order • Integer/rational gap-order, lower and upper bound • Integer/rational half-addition, lower and upper bound • Integer/rational gap-order, upper bound, and positive linear • Rational linear inequality • Real polynomial inequality • Boolean equality • Boolean order • atomless Boolean equality and inequality

  4. points(DB) – the logical level infinite relation/database that is equivalent to the constraint relation/database DB. For any relational algebra operator/query O on infinite databases we can always find a finitely evaluable relational algebra operator/query ô on constraint databases such that: O(points(DB)) = points(ô(DB)) 9.2 Evaluation of Relational Algebra Queries

  5. Example: A B C ^ C = A ∩ B D ^ D = A υ B

  6. Example: E ^ E = A – B F ^ F = x E = y E

  7. 9.3 Evaluation of SQL queries Max/Min evaluated by linear programming if all constraints are linear inequalities. Example: SELECT Min(x) FROM E will return 7.

  8. 9.4 Evaluation of Datalog Queries Constraint instantiation – substitution of rule body relation symbols by constraint tuples. Constraint proof – constraint tuple t0 R0can be proven in query Q and database instance I, written t |Q,I R0, if • t  R0, or • there is a constraint instantiation t0(...) :– t1(…), …, tn(…). where ti |Q,I Ri for 1 ≤ i ≤ n and t0 = * t1(…), …, tn(…) where * are variables that appear only in the rule body.

  9. Theorem: The proof-based and the constraint proof-based semantics are equivalent. {(a1,…,an): |Q,IR(a1,….,ak)} = {points(t): |Q,It  R}

  10. Datalog evaluation algorithm Repeat • do constraint rule instantiation using the constraint tuples already in the DB • evaluate the rule, using variable elimination • add the derived constraint tuple to the DB, if it is at least partially new Until any tuple is added to DB The goal is to prove termination of the above algorithm.

  11. Evaluation terminates (in closed-form) for: • Infinite domain equality and inequality • Rational order • Integer/rational half-addition, lower and upper bound • Integer/rational gap-order, upper bound, positive linear • Boolean order

  12. Approximate evaluation for integer/rational addition– Let l be a fixed negative constant. We modify in each constraint tuple each constraint with bound b < l by: • changing b to l to get a lower bound Q(D)l • deleting the constraint to get an upper bound Q(D)l The approximate evaluation terminates and returns correct upper and lower bounds, that is, Q(D)l Q(D)  Q(D)l also, for any l1 and l2 such that l1 ≤ l2 < 0: Q(D)l2 Q(D)l1 and Q(D)l1 Q(D)l2

More Related