query execution

Friday, 8 June 2012 · 2 messages
RB
Radim Bača8 Jun 2012 15:28 #
Hello, I'm interested about BaseX technical details and its query exectution techniques. BaseX uses structural joins such as XPath accelerator as a main tree-join for a location step execution? In other words, do you use some other type joins a as well (i.e. holistic joins such as TwigStack)? I investigated the execution plans however I was not able to find any information about indexes used by each operation. Can I observe it from the plan like this:
<QueryPlan>
<GFLWOR>
<For var="$b">
<IterPath>
<DBNode name="xmark" pre="0"/>
<IterStep axis="child" test="*:site"/>
<IterStep axis="child" test="*:regions"/>
<IterStep axis="child" test="*"/>
<IterStep axis="child" test="*:item"/>
</IterPath>
</For>
<Let var="$k">
<AxisPath>
<VarRef>
<Var name="$b" id="0"/>
</VarRef>
<IterStep axis="child" test="name"/>
<IterStep axis="child" test="text()"/>
</AxisPath>
</Let>
<Order>
<OrderByExpr dir="ascending" empty="greatest">
<FNSimple name="zero-or-one(item)">
<AxisPath>
<VarRef>
<Var name="$b" id="0"/>
</VarRef>
<IterStep axis="child" test="location"/>
</AxisPath>
</FNSimple>
</OrderByExpr>
</Order>
<Return>
<CElem>
<QNm value="item" type="xs:QName"/>
<CAttr>
<QNm value="name" type="xs:QName"/>
<VarRef>
<Var name="$k" id="1"/>
</VarRef>
</CAttr>
<AxisPath>
<VarRef>
<Var name="$b" id="0"/>
</VarRef>
<IterStep axis="child" test="location"/>
<IterStep axis="child" test="text()"/>
</AxisPath>
</CElem>
</Return>
</GFLWOR>
</QueryPlan>
XQuery:
for $b in /site/regions//item
let $k := $b/name/text()
order by zero-or-one($b/location) ascending empty greatest
return <item name="{$k}">{$b/location/text()}</item>
Thank you for any response, Radim
CG
Christian Grün8 Jun 2012 15:40 #
Dear Radim, thanks for your e-mail. Our current optimization techniques have gone pretty far away from the original XPath Accelerator and Staircase Join approaches. The main similarity with those concepts is the underlying, tabular XML storage, which allows us to parse all nodes in a sequential way, no matter how the XML documents are structured. This is also why we didn not implement any holistic joins; instead, we often decide on the fly (i.e., in an iterative manner), if paths have to be completely evaluated at all. For more information on how we store and query our data, feel free to have a look at some of our publications; »Storing and Querying Large XML Instances.« may be most interesting to you. Feel free to ask for more, Christian
Quoted text · Radim Bača · 76 lines
> I'm interested about BaseX technical details and its query exectution > techniques. BaseX uses structural joins such as XPath accelerator as a main > tree-join for a location step execution? In other words, do you use some > other type joins a as well (i.e. holistic joins such as TwigStack)? > > I investigated the execution plans however I was not able to find any > information about indexes used by each operation. Can I observe it from the > plan like this: > <QueryPlan> > <GFLWOR> > <For var="$b"> > <IterPath> > <DBNode name="xmark" pre="0"/> > <IterStep axis="child" test="*:site"/> > <IterStep axis="child" test="*:regions"/> > <IterStep axis="child" test="*"/> > <IterStep axis="child" test="*:item"/> > </IterPath> > </For> > <Let var="$k"> > <AxisPath> > <VarRef> > <Var name="$b" id="0"/> > </VarRef> > <IterStep axis="child" test="name"/> > <IterStep axis="child" test="text()"/> > </AxisPath> > </Let> > <Order> > <OrderByExpr dir="ascending" empty="greatest"> > <FNSimple name="zero-or-one(item)"> > <AxisPath> > <VarRef> > <Var name="$b" id="0"/> > </VarRef> > <IterStep axis="child" test="location"/> > </AxisPath> > </FNSimple> > </OrderByExpr> > </Order> > <Return> > <CElem> > <QNm value="item" type="xs:QName"/> > <CAttr> > <QNm value="name" type="xs:QName"/> > <VarRef> > <Var name="$k" id="1"/> > </VarRef> > </CAttr> > <AxisPath> > <VarRef> > <Var name="$b" id="0"/> > </VarRef> > <IterStep axis="child" test="location"/> > <IterStep axis="child" test="text()"/> > </AxisPath> > </CElem> > </Return> > </GFLWOR> > </QueryPlan> > > > XQuery: > for $b in /site/regions//item > let $k := $b/name/text() > order by zero-or-one($b/location) ascending empty greatest > return <item name="{$k}">{$b/location/text()}</item> > > > Thank you for any response, > > Radim > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

⚡Generated with XQuery