bhabegger commented on code in PR #2724:
URL: https://github.com/apache/jackrabbit-oak/pull/2724#discussion_r2767442793


##########
oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java:
##########
@@ -1117,12 +1115,6 @@ private SelectorExecutionPlan 
getBestSelectorExecutionPlan(
                     if (p.getSupportsPathRestriction()) {
                         entryCount = scaleEntryCount(rootState, filter, 
entryCount);
                     }
-                    if (sortOrder == null || p.getSortOrder() != null) {
-                        // if the query is unordered, or
-                        // if the query contains "order by" and the index can 
sort on that,
-                        // then we don't need to read all entries from the 
index
-                        entryCount = Math.min(maxEntryCount, entryCount);
-                    }

Review Comment:
   The issue with limit is that the same index will not be chose with or 
without the limit which in certain cases is surprising.
   
   This said, I completely understand that taking a sorting capable index over 
one which doesn't support it. So here the challenge is that we have cases which 
favor one and cases which favor the other. But maybe, couldn't we always favor 
indices which support sorting systematically rather than only if their is a 
limit ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to