80 likes | 232 Views
A Logical Framework for XQuery Optimization. Alin Deutsch Yannis Papakonstantinou Yu Xu University of California, San Diego. Groupby Normal Form Tree Patterns (GNFTPs). Tree patterns have been used to describe XPath and navigation and resolve logical optimization problems
E N D
A Logical Framework for XQuery Optimization Alin Deutsch Yannis Papakonstantinou Yu Xu University of California, San Diego
Groupby Normal Form Tree Patterns (GNFTPs) • Tree patterns have been used to describe XPath and navigation and resolve logical optimization problems • Extend into GNFTP to capture • nested queries • mixed set, bag (and list) semantics • Normalization reduces multiple XQuery syntactic features into GNFTP
Reducing XQuery into Navigate, GroupBy, Construct FOR $authorINdistinct($doc/book/author) RETURN <authors_works> { $author, FOR $book IN $doc/book WHERE SOME $a IN $book/author SATISFIES $a = $author RETURN … FOR $author IN $doc/book/author GROUPBY $author // group by value RETURN <authors_works> { $author, FOR $book IN $doc/book $a IN $book/author WHERE $a = $author GROUPBY [$book] // group by identity + no $a RETURN $book } </authors_work>
Tree Pattern Representation X1 X2 $doc N1(X1; ;$author; f1($author, N2)) book $b1 book $book N2(X2; $book; ; f2($book)) author $author author $a f1($author, N2) = <authors_works> { $author, N2 } </author_works> f2($book) = $book
Minimization of Redundant Navigation: Collapse & Test $author [$book] $author [$book] X1 X2 X1 X2 $doc $doc book $b1 book $book book $book author $author author $a author $author
Minimization of Redundant Navigation: Collapse & Test $author $author X1 X1 $doc $doc Ul book $b1 book $book ? lU author $author author $author
Minimization of Redundant Navigation: Collapse & Test [$book] [$book] X1 X2 X1 X2 $doc $doc Ul book $b1 book $book book $book ? lU author $author author $a author $author
Results • We find the unique minimal equivalent of a GNFTP • Introducing id-based equalities is essential • Removal-based techniques lead to multiple “minima” • NP-complete, polynomial for acyclic tree patterns • Efficient in practice • Normalizer rewrites XQuery with no set equality condition or group-by set into GNFTP • extGNFTP = GNFTP + blackbox functions and blackbox predicates, which are not minimized http://www.db.ucsd.edu/people/alin/papers/next.pdf