Thomas Mueller created OAK-419:
----------------------------------

             Summary: Query: Conditions are not pushed to "outer join" selectors
                 Key: OAK-419
                 URL: https://issues.apache.org/jira/browse/OAK-419
             Project: Jackrabbit Oak
          Issue Type: Improvement
          Components: core
            Reporter: Thomas Mueller
            Assignee: Thomas Mueller
            Priority: Minor


Currently the query plan for the following query

    select * from [nt:base] as c 
    right outer join [nt:base] as p on p.id = c.p 
    where p.id is not null 
    and isdescendantnode(p, '/testRoot') 
    and isdescendantnode(c, '/testRoot')

is:

    [nt:base] as [p] 
    /* traverse "/testRoot//*" 
    where (([p].[id] is not null) 
    and (isdescendantnode([p], [/testRoot]))) 
    and ([p].[id] is not null) */ 
    left outer join [nt:base] as [c] 
    /* traverse "//*" 
    where (isdescendantnode([c], [/testRoot])) 
    and ([c].[p] is not null) */ 
    on [p].[id] = [c].[p]

Because of that, far too many nodes are traversed on [c].
Instead, the isdescendantnode condition should be pused to [c] so that
it only traverses "/testRoot//*".

The result of the query is still correct, but performance is potentially very 
bad (even if there is an index).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to