A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel...

28
A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering Queries Using Views. In Proceedings of VLDB 2000. Presented by: Paea LePendu [email protected]
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    216
  • download

    0

Transcript of A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel...

Page 1: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

A scalable algorithm for answering queries using views

Rachel Pottinger, Alon Levy [2000]Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering Queries Using Views. In Proceedings of VLDB 2000.

Presented by:Paea LePendu

[email protected]

Page 2: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Introduction

Θ Q(x) :- cites(x,y), cites(y,x), SameTopic(x,y)● This looks like a RULE (HEAD :- Body)● Join Predicates / Database relations

Θ But this paper is about VIEWS.

Θ SQL ↔ Views ↔ Rules

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

SQL ↔ Views ↔ Rules

Page 3: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Outline

Θ IntroductionΘ MotivationΘ ContributionsΘ AlgorithmsΘ Experimental resultsΘ Future work

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

SQL ↔ Views ↔ Rules

Bucket, MiniCon

Page 4: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

What is a view (in SQL)?

Θ Virtual TableΘ Logical dataΘ Query vs. View

Θ Materialized View

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

SQL ↔ Views ↔ Rules

Page 5: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Logical

Online Instructor Evaluation System for Whitman College, by Paea LePendu, 2003.

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 6: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Virtual Table

Online Instructor Evaluation System for Whitman College, by Paea LePendu, 2003.

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 7: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Re-cap

Θ SQL ↔ Views ↔ Rules

Θ SQL ↔ Views ↔ Rules

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 8: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Datalog

Θ Deductive DatabasesΘ Facts, rules, queries

● Forward Chaining● Backward Chaining

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

SQL ↔ Views ↔ Rules

Ramez Elmasri and Shamkant B. Navathe, Fundamentals of Database Systems (3rd Edition), Addison-Wesley, 2000.

Page 9: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Facts, Rules, Queries *

Θ superior(james,joyce)? :- supervise(X,Z), superior(Z,Y)(bindings: X→james, Z→franklin, Y→joyce)

Ramez Elmasri and Shamkant B. Navathe, Fundamentals of Database Systems (3rd Edition), Addison-Wesley, 2000.

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 10: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Re-cap

Θ Q(x) :- cites(x,y), cites(y,x), SameTopic(x,y)

Θ V4(a) :- cites(a,b), cites(b,a)

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

SQL ↔ Views ↔ Rules

Page 11: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Why rewrite a query using a view?

Θ Data managementΘ Data integrationΘ Query optimizationΘ Data independence

Θ Materialized Views

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 12: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Data Integration

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Maximally-containedrewriting

Conjunctive query

Materialized views

Page 13: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Contributions

Θ MiniConΘ Algorithm analysis

● Bucket● Inverse Rules● MiniCon

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 14: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Q :- V1, V2, ..., Vn

Θ NP completeΘ Bucket algorithmΘ Inverse rules algorithmΘ MiniCon algorithm

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p487.

Page 15: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Bucket

Θ Redundant rewritingsΘ Cartesian productΘ Inefficient

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p487.

Page 16: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Bucket

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p487.

Page 17: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Q :- V1, V2, ..., Vn

Θ Bucket algorithmΘ Inverse rules algorithmΘ MiniCon algorithm

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 18: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Inverse Rules

Θ Polynomial timeΘ Redundant rewritingsΘ Redeemable

● Back to Bucket

Pottinger et al. 2000 p488.

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 19: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Q :- V1, V2, ..., Vn

Θ Bucket algorithmΘ Inverse rules algorithmΘ MiniCon algorithm

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 20: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

MiniCon

Θ BucketΘ Change perspectiveΘ MCDΘ Eliminates redundancy

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 21: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

MCD

Θ Partial mappings from Vars(Q) to Vars(V)● Constraint: distinguished range contained in head variables

Θ Head homomorphism mappings

Θ Covered subgoals● Constraint: ranged existential variables are distinguished

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p489.

Page 22: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

MCD

V6(f,h)?

1 2 3

y→g?

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p489.

V4(a) | a→a | x→a, y→b | 1,2 (3) eliminated

Page 23: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

combineMCD

Θ Pair-wise disjoint subsets of subgoals● Define mappings Q↔V● Create conjunctive rewriting

Θ Union resulting conjunctive rewritings

Q1'(x) :- V6(x,x)

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p490.

V5(c,d) | c→c, d→d | x→c, y→d | 3 (1,2) eliminated

V6(f,f) | f→f, h→f | x→f, y→f | 1,2,3

Page 24: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Experimental Results

Θ Chain, Star, Complete Queries

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

(a) Steinbrunn, G. Moerkotte, and A. Kemper. Heuristic and randomized optimization for the join. VLDB Journal, 6(3):191-208, 1997. (b) W. Sun and C. Yu. Semantic Query Optimization for Tree and Chain Queries. IEEE Transactions on Knowledge and Data Engineering. 6(1):136-15, 1994. (c) http://www.eecs.umich.edu/db/mbench/images/chainTwig.ppt

Page 25: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Chain Queries

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p492.

Page 26: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Star and Complete Queries

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Pottinger et al. 2000 p493.

Page 27: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Future Work

Θ Query optimization

Θ Semantic Search ?

Introduction → Motivation → Contributions → Algorithms → Expmt'l Results → Future Work

Page 28: A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.

Questions for you

Θ Why the distinction between views and materialized views?

Θ Is a maximally-contained rewriting satisfactory?

Θ What similarities do you see with the Abiteboul et al paper (Correspondence and translation for heterogeneous data)?