[ 
https://issues.apache.org/jira/browse/OAK-8734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16973989#comment-16973989
 ] 

Nitin Gupta commented on OAK-8734:
----------------------------------

Fixed with [https://svn.apache.org/viewvc?view=revision&revision=1869780]

 

> Sorted query with multiple path restrictions and sorting performs very slowly 
> if one of the passed paths is a traversal 
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OAK-8734
>                 URL: https://issues.apache.org/jira/browse/OAK-8734
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>            Reporter: Nitin Gupta
>            Assignee: Nitin Gupta
>            Priority: Major
>
> A query like [1] with multiple path restrictions and an order can be 
> extremely slow .
>  * Removing the orderby makes it much faste.
>  * Removing one path will make it faster.
> The issue appears to be that, as soon as one path-restricred subquery is not 
> handled at the index (ie its a traversal, since the cost of traversal on an 
> empty path is 0), it appears that the entire sorting happens in the query 
> engine which makes the query very very slow if there are lots of items (and 
> defeats optimisations like guessTotal which prevent iteration / inflation of 
> the complete result set). 
>  [1]
> {code:java}
> (
>   /jcr:root/content/dam/products//element(*, dam:Asset)
> |
>   /jcr:root/content/dam/projects//element(*, dam:Asset))
>   order by jcr:content/@jcr:lastModified descendin
> )
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to