Performance question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Performance question

Bruno Chatel
Hi,

I wonder the reason of the time overspent by juste adding and ancestor search in my query result..

The first query just search for P element containing the word "bulk"

for $n in collection('bv/rules/en_03/doc')/dy:fragment/dy:content//P[. &= "bulk"]
return
 <dy:hit>
        <dy:node>{$n}</dy:node>
  </dy:hit>


=> 1652 ms

Now I need to get for each result the ID of the ANT ancestor element :

for $n in collection('bv/rules/en_03/doc')/dy:fragment/dy:content//P[. &= "bulk"]
return
 <dy:hit>
        <dy:iu>{$n/ancestor::ART/@ID}</dy:iu>
        <dy:node>{$n}</dy:node>
  </dy:hit>

=> 12658 ms

I try something like this

for $n in collection('bv/rules/en_03/doc')/dy:fragment/dy:content//ART[.//P &= "bulk"]
return
<dy:res>
  {for $p in $n//P[. &= "bulk"] return
 <dy:hit>
        <dy:iu>{$n/@ID}</dy:iu>
        <dy:node>{$p}</dy:node>
  </dy:hit>
}
</dy:res>

=> 10866 ms

Do you have an idea in order to improve this ?

Thanks in advance

-- bruno --


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Performance question

wolfgangmm
Hi,

I made some changes to the implementation of the ancestor axis
recently, so the problem might already be fixed in the current CVS
version. At least, running the queries on the 1450 files Jakob had
sent me, I can hardly see a difference in execution times between
query 1 and 2. Q1 takes 350ms, Q2 400. The final query Q3 takes 900ms
(on a 1.86 GHZ Pentium M notebook running WinXP).

Q3 could be optimized a bit by executing the fulltext expression only once:

let $h := //P &= "bulk"
for $n in collection('/db')/dy:fragment/dy:content//ART[$h]
return
<dy:res>
 {for $p in $n//$h return
 <dy:hit>
       <dy:iu>{$n/@ID}</dy:iu>
       <dy:node>{$p}</dy:node>
 </dy:hit>
}
</dy:res>

This results in a slight improvement of 150ms, but it might be more
for a more complex search expression.

Wolfgang


On 10/13/05, Bruno Chatel <[hidden email]> wrote:

> Hi,
>
> I wonder the reason of the time overspent by juste adding and ancestor search in my query result..
>
> The first query just search for P element containing the word "bulk"
>
> for $n in collection('bv/rules/en_03/doc')/dy:fragment/dy:content//P[. &= "bulk"]
> return
>  <dy:hit>
>         <dy:node>{$n}</dy:node>
>   </dy:hit>
>
>
> => 1652 ms
>
> Now I need to get for each result the ID of the ANT ancestor element :
>
> for $n in collection('bv/rules/en_03/doc')/dy:fragment/dy:content//P[. &= "bulk"]
> return
>  <dy:hit>
>         <dy:iu>{$n/ancestor::ART/@ID}</dy:iu>
>         <dy:node>{$n}</dy:node>
>   </dy:hit>
>
> => 12658 ms
>
> I try something like this
>
> for $n in collection('bv/rules/en_03/doc')/dy:fragment/dy:content//ART[.//P &= "bulk"]
> return
> <dy:res>
>   {for $p in $n//P[. &= "bulk"] return
>  <dy:hit>
>         <dy:iu>{$n/@ID}</dy:iu>
>         <dy:node>{$p}</dy:node>
>   </dy:hit>
> }
> </dy:res>
>
> => 10866 ms
>
> Do you have an idea in order to improve this ?
>
> Thanks in advance
>
> -- bruno --
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Exist-open mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/exist-open
>


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open