Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-579

Query: for joins, sometimes no or the wrong index is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.6
    • query
    • None

    Description

      Currently, no index is used for the join condition. For example, the query:

      select * from [nodeTypeA] as a 
      inner join [nodeTypeB] as b
      on isdescendantnode(b, a) 
      where lower(a.x) = 'y'
      and b.[property] is not null
      

      currently doesn't take into account that the path of the selector 'a' is known at the time selector 'b' is accessed (given that selector 'a' is executed first). So in this case, the query would use an index on the property b.[property], even if this index has a very bad selectivity (many nodes with this problem), or the query would use the node type index on [nodeTypeB], even if there are many nodes of this type.

      Instead, most likely the query should do a traversal, using the isdescendantnode(b, a) join condition.

      Attachments

        Activity

          People

            thomasm Thomas Mueller
            thomasm Thomas Mueller
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: