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


##########
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:
   Maybe we should split the discussion:
   * General discussion on sorting and limit
   * What we do in this particular PR ?
   
   
   For this PR I see the following options:
   * We keep it as is to favor the same index selection with or without limit 
(original ticket)
   * We skip it to favor an speed in case of limit (and accept that a different 
index maybe selected with or without limit)
   * We change it to add some sorting cost
   
   If we go for the last, what should we add ? What would be the formula ?



-- 
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