Hi,
with the new Version 9 I have encountered a strange performance issue: - Running a simple xpath-query is fast, as it is using the attribute-index. Execution time: 59.19 ms - Putting the same simple xpath-query into a function results in a very poor performance. No use of the attribute-index here. Execution time: 12578.55 ms
There where no issues with that in the previous Versions 8.x
Here’s the setup…
xquery version "3.1";
declare function local:slow_query_here() as node()* { prof:time( db:open("mars","data“)/sec[ @isin = "FR0000125338" ] ) (: 12578.55 ms :) };
let $fast_query_here := prof:time( db:open("mars","data“)/sec[ @isin = "FR0000125338" ] ) (: 59.19 ms :)
return local:slow_query_here()
Here’s the query plan… <QueryPlan compiled="true" updating="false"> <GFLWOR type="element()*"> <Let type="element()*"> <Var name="$fast_query_here" id="0" type="element()*"/> <ProfTime name="time(value[,label])" type="element()*"> <CachedPath type="element()*"> <ValueAccess index="attribute" type="attribute()*"> <IndexStaticDb name="mars" database="mars"/> <Str type="xs:string">FR0000125338</Str> </ValueAccess> <IterStep axis="self" test="*:base_isin" type="attribute()*"/> <CachedStep axis="parent" test="*:option" type="element()*"> <CachedPath> <IterStep axis="parent" test="*:option_list" type="element()*"/> <IterStep axis="parent" test="*:finance" type="element()*"/> <IterStep axis="parent" test="document-node()" type="document-node()*"/> </CachedPath> </CachedStep> </CachedPath> </ProfTime> </Let> <ProfTime name="time(value[,label])" type="element()*"> <CachedPath type="element()*" database="mars"> <DBNode database="mars" pre="0" type="document-node()"/> <IterStep axis="descendant" test="*:option_list" type="element()*"/> <IterStep axis="child" test="*:option" type="element()*"> <CmpSimpleG op="=" type="xs:boolean" size="1"> <CachedPath type="attribute()?"> <IterStep axis="attribute" test="*:base_isin" type="attribute()?"/> </CachedPath> <Str type="xs:string">FR0000125338</Str> </CmpSimpleG> </IterStep> </CachedPath> </ProfTime> </GFLWOR> </QueryPlan>
Any idea what’s causing the performance drop?
Thank you for your thoughts! Andre
Dear Andre,
Thanks for your observations, which bear some similarity to what another user reported in Github [1]. I’ll get back to you soon.
Best, Christian
[1] https://github.com/BaseXdb/basex/issues/1553
On Fri, Mar 30, 2018 at 10:32 AM, andre weber atmo@gmx.de wrote:
Hi,
with the new Version 9 I have encountered a strange performance issue:
- Running a simple xpath-query is fast, as it is using the attribute-index. Execution time: 59.19 ms
- Putting the same simple xpath-query into a function results in a very poor performance. No use of the attribute-index here. Execution time: 12578.55 ms
There where no issues with that in the previous Versions 8.x
Here’s the setup…
xquery version "3.1";
declare function local:slow_query_here() as node()* { prof:time( db:open("mars","data“)/sec[ @isin = "FR0000125338" ] ) (: 12578.55 ms :) };
let $fast_query_here := prof:time( db:open("mars","data“)/sec[ @isin = "FR0000125338" ] ) (: 59.19 ms :)
return local:slow_query_here()
Here’s the query plan…
<QueryPlan compiled="true" updating="false"> <GFLWOR type="element()*"> <Let type="element()*"> <Var name="$fast_query_here" id="0" type="element()*"/> <ProfTime name="time(value[,label])" type="element()*"> <CachedPath type="element()*"> <ValueAccess index="attribute" type="attribute()*"> <IndexStaticDb name="mars" database="mars"/> <Str type="xs:string">FR0000125338</Str> </ValueAccess> <IterStep axis="self" test="*:base_isin" type="attribute()*"/> <CachedStep axis="parent" test="*:option" type="element()*"> <CachedPath> <IterStep axis="parent" test="*:option_list" type="element()*"/> <IterStep axis="parent" test="*:finance" type="element()*"/> <IterStep axis="parent" test="document-node()" type="document-node()*"/> </CachedPath> </CachedStep> </CachedPath> </ProfTime> </Let> <ProfTime name="time(value[,label])" type="element()*"> <CachedPath type="element()*" database="mars"> <DBNode database="mars" pre="0" type="document-node()"/> <IterStep axis="descendant" test="*:option_list" type="element()*"/> <IterStep axis="child" test="*:option" type="element()*"> <CmpSimpleG op="=" type="xs:boolean" size="1"> <CachedPath type="attribute()?"> <IterStep axis="attribute" test="*:base_isin" type="attribute()?"/> </CachedPath> <Str type="xs:string">FR0000125338</Str> </CmpSimpleG> </IterStep> </CachedPath> </ProfTime> </GFLWOR> </QueryPlan>
Any idea what’s causing the performance drop?
Thank you for your thoughts! Andre
Hi Andre,
The problem has been fixed [1]. A new snapshot is available [2]. BaseX 9.0.1 will probably be released around the end of April.
Best, Christian
[1] https://github.com/BaseXdb/basex/commit/4500547038ff69b99d04751768ac328d5276... [2] http://files.basex.org/releases/latest/
On Sat, Mar 31, 2018 at 5:10 PM, Christian Grün christian.gruen@gmail.com wrote:
Dear Andre,
Thanks for your observations, which bear some similarity to what another user reported in Github [1]. I’ll get back to you soon.
Best, Christian
[1] https://github.com/BaseXdb/basex/issues/1553
On Fri, Mar 30, 2018 at 10:32 AM, andre weber atmo@gmx.de wrote:
Hi,
with the new Version 9 I have encountered a strange performance issue:
- Running a simple xpath-query is fast, as it is using the attribute-index. Execution time: 59.19 ms
- Putting the same simple xpath-query into a function results in a very poor performance. No use of the attribute-index here. Execution time: 12578.55 ms
There where no issues with that in the previous Versions 8.x
Here’s the setup…
xquery version "3.1";
declare function local:slow_query_here() as node()* { prof:time( db:open("mars","data“)/sec[ @isin = "FR0000125338" ] ) (: 12578.55 ms :) };
let $fast_query_here := prof:time( db:open("mars","data“)/sec[ @isin = "FR0000125338" ] ) (: 59.19 ms :)
return local:slow_query_here()
Here’s the query plan…
<QueryPlan compiled="true" updating="false"> <GFLWOR type="element()*"> <Let type="element()*"> <Var name="$fast_query_here" id="0" type="element()*"/> <ProfTime name="time(value[,label])" type="element()*"> <CachedPath type="element()*"> <ValueAccess index="attribute" type="attribute()*"> <IndexStaticDb name="mars" database="mars"/> <Str type="xs:string">FR0000125338</Str> </ValueAccess> <IterStep axis="self" test="*:base_isin" type="attribute()*"/> <CachedStep axis="parent" test="*:option" type="element()*"> <CachedPath> <IterStep axis="parent" test="*:option_list" type="element()*"/> <IterStep axis="parent" test="*:finance" type="element()*"/> <IterStep axis="parent" test="document-node()" type="document-node()*"/> </CachedPath> </CachedStep> </CachedPath> </ProfTime> </Let> <ProfTime name="time(value[,label])" type="element()*"> <CachedPath type="element()*" database="mars"> <DBNode database="mars" pre="0" type="document-node()"/> <IterStep axis="descendant" test="*:option_list" type="element()*"/> <IterStep axis="child" test="*:option" type="element()*"> <CmpSimpleG op="=" type="xs:boolean" size="1"> <CachedPath type="attribute()?"> <IterStep axis="attribute" test="*:base_isin" type="attribute()?"/> </CachedPath> <Str type="xs:string">FR0000125338</Str> </CmpSimpleG> </IterStep> </CachedPath> </ProfTime> </GFLWOR> </QueryPlan>
Any idea what’s causing the performance drop?
Thank you for your thoughts! Andre
basex-talk@mailman.uni-konstanz.de