pathfinder
play

Pathfinder: /| child::element person { item* } (iter, item1) /| - PowerPoint PPT Presentation

SERIALIZE (item, pos) ROW# (pos:<pos1>) (pos1, item) FRAG_UNION |X| (iter = iter1) FRAGs ROOTS ELEM (iter1, item:<iter1, item><iter1, pos, item>) ELEM_TAG (iter1, item, pos) @ (item), val: item ROW#


  1. SERIALIZE ¶ (item, pos) ROW# (pos:<pos1>) ¶ (pos1, item) FRAG_UNION |X| (iter = iter1) FRAGs ROOTS ELEM (iter1, item:<iter1, item><iter1, pos, item>) ELEM_TAG ¶ (iter1, item, pos) @ (item), val: item ROW# (pos:<pos1>/iter1) U @ (pos1), val: #1 @ (pos1), val: #2 FRAG_UNION ¶ (iter1, item) ¶ (iter1, item) FRAG_UNION ROOTS FRAGs ROOTS FRAGs TEXT (item:<item2>) ATTR (item:<item2, item1>) CAST (item2:<item1>), type: str @ (item2), val: person U fn:string_join @ (item1), val: 0 @ (item1), val: " " DIFF ¶ (iter1:iter) ¶ (iter1) ¶ (iter1, item1, pos) COUNT (item1:/iter1) ROW# (pos:<pos1>/iter1) ¶ (iter1) ¶ (iter1, pos1, item1) DISTINCT ¶ (iter, iter1) |X| (item1 = item) access textnode content (item1:<item>) ¶ (iter, item1) ¶ (iter1, item) ROW# (pos1:<item>/iter1) access attribute value (item1:<item>) access attribute value (item:<item1>) /| child::text (iter1, item) ¶ (item, iter:iter2) ¶ (item1, iter1:iter2) /| child::element name { item* } (iter1, item) /| attribute::attribute person { atomic* } (iter2, item) /| attribute::attribute id { atomic* } (iter2, item1) ¶ (item:item1, iter1:iter) /| child::element buyer { item* } (iter2, item) ¶ (item1, iter2:iter) NUMBER (iter) ¶ (item:item1, iter2:iter) ROW# (pos1:<item1>) NUMBER (iter) ¶ (item1) ¶ (item1) Pathfinder: /| child::element person { item* } (iter, item1) /| child::element closed_auction { item* } (iter, item1) /| child::element people { item* } (iter, item1) /| child::element closed_auctions { item* } (iter, item1) /| child::element site { item* } (iter, item1) FRAG_UNION ROOTS A Relational Query Optimizer EMPTY_FRAG FRAGs DOC TBL: (iter | item1) [#1,"auctionG.xml"] Explores XQuery Terrain Torsten Grust · Jan Rittinger · Jens Teubner · TU M¨ unchen

  2. Source Language: XQuery Core Pathfinder consumes XQuery with arbitrary expression nestings . . . literals 42 , "foo" , () , . . . arithmetics e 1 + e 2 , e 1 - e 2 , . . . built-in functions fn:sum( e ) , fn:count( e ) , fn:doc( uri ) , . . . variable bindings let $ v := e 1 return e 2 iteration for $ v at $ p in e 1 return e 2 conditionals if p then e 1 else e 2 sequence construction e 1 , e 2 user-defd. functions f ( e 1 , e 2 , ..., e n ) element construction element e 1 { e 2 } XPath steps e / α :: ν (full axis feature) . . . . . . Pathfinder—A Relational Query Optimizer Explores XQuery Terrain BTW 2007 2 / 6

  3. Source Language: XQuery Core Pathfinder consumes XQuery with arbitrary expression nestings . . . FULL XQUERY SUPPORT FULL XQUERY SUPPORT literals 42 , "foo" , () , . . . arithmetics e 1 + e 2 , e 1 - e 2 , . . . built-in functions fn:sum( e ) , fn:count( e ) , fn:doc( uri ) , . . . variable bindings let $ v := e 1 return e 2 iteration for $ v at $ p in e 1 return e 2 conditionals if p then e 1 else e 2 sequence construction e 1 , e 2 user-defd. functions f ( e 1 , e 2 , ..., e n ) element construction element e 1 { e 2 } XPath steps e / α :: ν (full axis feature) . . . . . . Pathfinder—A Relational Query Optimizer Explores XQuery Terrain BTW 2007 2 / 6

  4. Target Language: Relational Algebra . . . and compiles them into plans of a standard relational algebra. π column projection, renaming σ row selection equi-join ⋊ ⋉ × Cartesian product ∪ , \ · disjoint union, difference δ duplicate elimination ̺ row numbering staircase join 1 element/text node construction 1 ε , τ ⊛ arithmetic/comparison/Boolean operator ∗ ◮ Operates on node (not tree!) level and 1NF relations. 1 Syntactic sugar; expressible by remaining operators. Pathfinder—A Relational Query Optimizer Explores XQuery Terrain BTW 2007 3 / 6

  5. Target Language: Relational Algebra . . . and compiles them into plans of a standard relational algebra. π column projection, renaming Y Y L L σ row selection T T E E N N L L E E equi-join ⋊ ⋉ B B I I S S A A C C T T × Cartesian product T T I I S S N N F F O O E E ∪ , \ · disjoint union, difference F F H H M M E E E E δ duplicate elimination 9 9 L L 9 9 P P ̺ row numbering M M L L I I Q Q staircase join 1 S S element/text node construction 1 N N ε , τ O O ⊛ arithmetic/comparison/Boolean operator ∗ ◮ Operates on node (not tree!) level and 1NF relations. 1 Syntactic sugar; expressible by remaining operators. Pathfinder—A Relational Query Optimizer Explores XQuery Terrain BTW 2007 3 / 6

  6. Relational Query Optimization for XQuery SERIALIZE ¶ (iter:outer, pos:pos1, item) ROW# (pos1:<sort, pos>/outer) |X| (iter = inner) FRAG_UNION @ (pos), val: #1 FRAGs ROOTS ELEM (iter, item:<iter, item><iter, pos, item>) ELEM_TAG ¶ (iter, pos:pos1, item) @ (item), val: item ROW# (pos1:<ord, pos>/iter) U FRAG_UNION @ (ord), val: #1 @ (ord), val: #2 FRAG_UNION ¶ (iter, pos, item:res) @ (pos), val: #1 FRAGs ROOTS ¶ (iter, item:res) ATTR (res:<item, item1>) FRAGs ROOTS |X| (iter = iter1) TEXT (res:<cast>) ¶ (iter1:iter, item1:item) CAST (cast:<item>), type: str @ (item), val: person @ (pos), val: #1 @ (pos), val: #1 fn:string_join U @ (item), val: " " @ (item), val: 0 ¶ (iter) DIFF To combat the resulting plan sizes, Pathfinder uses @ (pos), val: #1 ¶ (iter) ¶ (iter) COUNT (item:/iter) ¶ (iter:outer, pos:pos1, item) ¶ (iter:outer) ROW# (pos1:<sort, pos>/outer) |X| (iter = inner) ¶ (iter, pos, item) |X| (iter = iter1) ¶ (iter1:iter) SEL (item) ¶ (iter, pos, item:res) NOT (res:<item>) @ (pos), val: #1 U @ (item), val: false @ (item), val: true DIFF DISTINCT ¶ (iter:outer) ¶ (iter) ROW# (pos1:<sort, pos>/outer) |X| (iter = inner) @ (item), val: 1 @ (pos), val: #1 ¶ (iter) SEL (item) ¶ (iter, pos, item:res) NOT (res:<item>) @ (pos), val: #1 U @ (item), val: false @ (item), val: true DIFF DISTINCT ¶ (iter:outer) ¶ (iter) ROW# (pos1:<sort, pos>/outer) |X| (iter = inner) @ (item), val: 1 @ (pos), val: #1 ¶ (iter) SEL (item) ¶ (iter, pos, item:res) = (res:<item, item1>) |X| (iter = iter1) ¶ (iter, pos, item:cast) ¶ (iter1:iter, item1:cast) CAST (cast:<item>), type: str CAST (cast:<item>), type: str ¶ (iter:inner, pos, item) @ (pos), val: #1 |X| (iter = outer) ¶ (iter:inner, item) @ (pos), val: #1 ¶ (outer:iter, sort:pos, inner) NUMBER (inner) ¶ (iter:inner, item) ¶ (iter:outer, pos:pos1, item) ROW# (pos1:<sort, pos>/outer) |X| (iter = inner) ¶ (iter, pos, item:cast) XMark Q8 · 34 MB · Intel Xeon 3.2 GHz · 8 GB RAM CAST (cast:<item>), type: uA ¶ (outer:iter, sort:pos, inner) ¶ (iter, pos, item:res) access attribute value (res:<item>) @ (pos), val: #1 ¶ (iter:inner, item) NUMBER (inner) ROW# (pos:<item>/iter) DISTINCT ¶ (iter, item) ROW# (pos:<item>/iter) /| attribute::attribute id { atomic* } (iter, item) ¶ (iter:inner, item) |X| (iter = outer) ¶ (iter:inner, pos, item) ¶ (outer:iter, sort:pos, inner) NUMBER (inner) ¶ (iter:outer, pos:pos1, item) ROW# (pos1:<sort, pos>/outer) |X| (iter = inner) ¶ (iter, pos, item:cast) CAST (cast:<item>), type: uA ¶ (outer:iter, sort:pos, inner) ¶ (iter, pos, item:res) access attribute value (res:<item>) @ (pos), val: #1 ¶ (iter:inner, item) NUMBER (inner) ROW# (pos:<item>/iter) DISTINCT ¶ (iter, item) ROW# (pos:<item>/iter) /| attribute::attribute person { atomic* } (iter, item) ¶ (iter, item) ROW# (pos:<item>/iter) DISTINCT ¶ (iter, item) ROW# (pos:<item>/iter) /| child::element buyer { item* } (iter, item) ¶ (iter, item) @ (pos), val: #1 |X| (iter = outer) ¶ (iter:inner, item) ¶ (outer:iter, sort:pos, inner) ROW# (pos1:<sort, pos>/outer) NUMBER (inner) |X| (iter = inner) ROW# (pos:<item>/iter) ¶ (iter, pos, item:res) DISTINCT access textnode content (res:<item>) ¶ (outer:iter, sort:pos, inner) ¶ (iter, item) @ (pos), val: #1 ROW# (pos:<item>/iter) ¶ (iter:inner, item) /| child::element closed_auction { item* } (iter, item) NUMBER (inner) ¶ (iter, item) ROW# (pos:<item>/iter) ROW# (pos:<item>/iter) DISTINCT DISTINCT ¶ (iter, item) ¶ (iter, item) ROW# (pos:<item>/iter) ROW# (pos:<item>/iter) /| child::text (iter, item) /| child::element closed_auctions { item* } (iter, item) ¶ (iter, item) ¶ (iter, item) ROW# (pos:<item>/iter) ROW# (pos:<item>/iter) DISTINCT DISTINCT ¶ (iter, item) ¶ (iter, item) ROW# (pos:<item>/iter) ROW# (pos:<item>/iter) /| child::element name { item* } (iter, item) /| child::element site { item* } (iter, item) ¶ (iter, item) ¶ (iter:inner, item) @ (pos), val: #1 |X| (iter = outer) ¶ (iter:inner, item) ¶ (outer:iter, sort:pos, inner) NUMBER (inner) ROW# (pos:<item>/iter) DISTINCT ¶ (iter, item) ROW# (pos:<item>/iter) /| child::element person { item* } (iter, item) ¶ (iter, item) ROW# (pos:<item>/iter) DISTINCT ¶ (iter, item) ROW# (pos:<item>/iter) /| child::element people { item* } (iter, item) ¶ (iter, item) ROW# (pos:<item>/iter) Resulting query runtime (MonetDB/XQuery): DISTINCT ¶ (iter, item) ROW# (pos:<item>/iter) /| child::element site { item* } (iter, item) FRAG_UNION ¶ (iter, item) EMPTY_FRAG @ (pos), val: #1 FRAGs ROOTS DOC @ (item), val: "auctionG.xml" ¶ (iter) @ (pos), val: #1 TBL: (iter) [#1] 0 112 sec Pathfinder—A Relational Query Optimizer Explores XQuery Terrain BTW 2007 5 / 6

Recommend


More recommend