Amit Jain created OAK-2081:
------------------------------

             Summary: [Ordered Index] Incorrect index plan selection 
                 Key: OAK-2081
                 URL: https://issues.apache.org/jira/browse/OAK-2081
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: query
            Reporter: Amit Jain


When an ordered index is defined on multiple properties the plan selection 
seems to be incorrect. There are a few potential problems :
* For > or < conditions, the cost is doubled because of incorrect condition in 
{{OrderedContentMirrorStoreStrategy#count}}. The condition should be {{cost >= 
max}} instead of {{count > max}}

* If multiple properties are specified in the index definition, only the first 
property is indexed and others ignored. IMO only the first should be used when 
selecting the plan in {{OrderedPropertyIndexLookup#getIndexNode()}}, otherwise 
it may happen that the property restriction that is not indexed is used for the 
index plan.

* In {{QueryImpl#getBestSelectorExecutionPlan}} limit is used to damp the cost 
which does not look right. E.g. limit is set to 10 and 2 plans with cost 190 
and 110 are candidates, the plan ultimately selected out of the 2 after damping 
with the limit will be arbitrary (the first to be processed) as the actual 
estimated cost is effectively ignored.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to