[
https://issues.apache.org/jira/browse/OAK-4681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15594521#comment-15594521
]
Thomas Mueller commented on OAK-4681:
-------------------------------------
Yes, using "union" in some cases can reduce performance. However, the way this
is done (for SQL-2, OAK-1617) is:
* first get the cost of the original query (with "or" condition)
* then get the cost of the union query
* pick the one that has a lower cost
So, if Lucene reports a lower cost with "or", then the query is not converted
to union.
> Automatically convert *all* "or" queries to "union" for SQL-2
> -------------------------------------------------------------
>
> Key: OAK-4681
> URL: https://issues.apache.org/jira/browse/OAK-4681
> Project: Jackrabbit Oak
> Issue Type: New Feature
> Components: query
> Reporter: Thomas Mueller
> Assignee: Thomas Mueller
> Fix For: 1.6
>
>
> Currently, in OAK-1617, simple SQL-2 queries that contain "or" are converted
> to "union" if the cost is lower. However, more complex queries are not
> converted, see AndImpl.java, convertToUnion(), "in this case prefer to be
> conservative and don't optimize. This could happen when for example: WHERE (a
> OR b) AND (c OR d)."
> It is implemented for XPath, and works fine there, so I think it is
> reasonable to do that for SQL-2 as well for trunk.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)