Answering Queries and Hypertree Decompositions Conjunctive Queries The

  • Slides: 15
Download presentation
Answering Queries and Hypertree Decompositions

Answering Queries and Hypertree Decompositions

Conjunctive Queries The problem BCQ: Instance: < DB, Q> Question: Has Q a nonempty

Conjunctive Queries The problem BCQ: Instance: < DB, Q> Question: Has Q a nonempty result over DB? Combined Complexity (Vardi ’ 82)

Problems Equivalent to BCQ Conjunctive Query Containment Query of Tuple Problem Constraint Satisfaction in

Problems Equivalent to BCQ Conjunctive Query Containment Query of Tuple Problem Constraint Satisfaction in AI Clause Subsumption in Theorem Proving

Example of CSP: Crossword Puzzle

Example of CSP: Crossword Puzzle

Complexity of BCQ NP-complete in the general case (Chandra and Merlin ’ 77) NP-hard

Complexity of BCQ NP-complete in the general case (Chandra and Merlin ’ 77) NP-hard even for fixed database Polynomial if Q has an acyclic hypergraph (Yannakakis ’ 81) LOGCFL-complete (in NC 2) (G. L. S. ’ 98) Interest in larger tractable classes of CQS

Is this query hard? n m size of the database number of atoms in

Is this query hard? n m size of the database number of atoms in the query • Classical methods worst-case complexity: m = 11 ! O(n m) • Despite its apparence, this query is nearly acyclic It can be evaluated in O(m·n 2· logn)

Nearly Acyclic Queries Bounded Treewidth (tw) n a measure of the cyclicity of graphs

Nearly Acyclic Queries Bounded Treewidth (tw) n a measure of the cyclicity of graphs n for queries: tw(Q) = tw(G(Q)) For fixed k: n checking tw(Q) k n Computing a tree decomposition linear time (Bodlaender’ 96) Answering BCQ of treewidth k: O(nk log n) (Chekuri & Rajaraman’ 97) LOGCFL-complete (G. L. S. ’ 98)

Beyond treewidth Bounded Degree of Cyclicity (Gyssens & Paredaens ’ 84) Bounded Query width

Beyond treewidth Bounded Degree of Cyclicity (Gyssens & Paredaens ’ 84) Bounded Query width (Chekuri & Rajaraman ’ 97) Group together query atoms (hyperedges) instead of variables

Hypertree Decomposition We group atoms p(X, Y, Z), q(U, V, Z) a(X, U, W),

Hypertree Decomposition We group atoms p(X, Y, Z), q(U, V, Z) a(X, U, W), b(Y, V, W) We use p(X, Y, Z) partially p(X, Y, _), c(T, W) d(X, T) c(Y, T)

Evaluating queries having bounded hypertree width k fixed Given: a database db a query

Evaluating queries having bounded hypertree width k fixed Given: a database db a query Q over db such that hw(Q) k a width k hypertree decomposition of Q Deciding whether Q(db) is not empty is in O(n k+1 log n) and complete for LOGCFL Computing Q(db) is feasible in output-polynomial time

Comparison results Hypertree Decomposition Hinge Decomposition + Tree Clustering Hinge Decomposition Cycle Hypercutset Tree

Comparison results Hypertree Decomposition Hinge Decomposition + Tree Clustering Hinge Decomposition Cycle Hypercutset Tree Clustering w* treewidth Biconnected Components Cycle Cutset

Characterizations of Hypertree width Logical characterization: Loosely guarded logic Game characterization: The robber and

Characterizations of Hypertree width Logical characterization: Loosely guarded logic Game characterization: The robber and marshals game

Work in progress Answering queries and hypertree decompositions: n n A query-planner based on

Work in progress Answering queries and hypertree decompositions: n n A query-planner based on hypertree decompositions Choosing the best query plan (i. e. , the best decomposition) exploiting data on tables, attibute selectivity, indices, etc. Further possible applications: n Answering queries using views