« Return to Thread: xquery nested loops
Hi,
Adam Retter schrieb:
>Well, I had the fulltext index specified for everything but now added
> Have you set up appropriate indexes?
qnames for Publish and Ordering (see below). There is a small
improvement but still I don't know why such a query should take more
than 1-2 seconds. I have no idea if my xquery is so expensive or what I
should change to not have a near 100% processor load for more than 5-10
seconds...
Thanks, Max
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index>
<fulltext default="all" attributes="yes"/>
<!-- Range indexes -->
<create qname="@Guid" type="xs:string"/>
<create qname="@Publish" type="xs:boolean"/>
<create qname="@Ordering" type="xs:integer"/>
</index>
</collection>
>
>
> 2008/4/25 Max Gaerber <mgaerber@... <mailto:mgaerber@...>>:
> <mailto:Exist-open@...>>
> Hi all,
>
> I've got a question about performance tuning and nested xquery loops.
> The data to be queried has several nesting levels, e.g.
>
> <Publication Guid="a">
> <CategoryLink Guid="b" Ordering="1" Publish="true">
> <ProductInfoLink Guid="c" ...>
> <ProductItemLink Guid="d" ...>
>
> A Publication has 5-20 Category elements with each about 50
> ProductInfo
> elements with each 2-10 ProductItem. Publication is only a "wrapper"
> declaring some extra information whereas the "real" data of
> ProductInfo
> etc. come from another collection.
>
> There are three functions similar to the one below which loop through
> the element set and create xhtml for display on a web site. The
> call to
> local:ProductInfos($catLink) processes the next nesteing level and so
> on. Now, the query is quite slow ( > 10 seconds ) even for small
> Publications. Is there a better way to handle this sort of nesting?
>
> declare function local:Categories($pub as node()) as node()? {
> <ul class="categories"> {
> for $catLink in $pub/CategoryLink
> let $cat := collection(/Syncrovet/Category)//Category[@Guid =
> $catLink/@Guid]
> let $publish := ($catLink/@Publish = "true")
> order by $catLink/@Ordering
> return
> <li class="category {if ($publish) then "included" else
> "excluded"}" id="{$catLink/@Guid}">
> <span class="name">{$cat/Name cast as xs:string}</span>
> { local:Tags($catLink) }
> { if ($publish) then local:ProductInfos($catLink) else () }
> </li>
> }</ul>
> };
>
> Thanks,
>
> Max
>
>
>
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save
> $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Exist-open mailing list
> Exist-open@...
> https://lists.sourceforge.net/lists/listinfo/exist-open> adam@... <mailto:adam@...>
>
>
>
>
> --
> Adam Retter
>
> eXist Developer
> { England }
> irc://irc.freenode.net/existdb <http://irc.freenode.net/existdb>
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open
« Return to Thread: xquery nested loops
| Free Forum Powered by Nabble | Forum Help |