Skip to content

Commit 3e0d402

Browse files
committed
Address comments.
1 parent 093155c commit 3e0d402

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteIndexManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,12 @@ public IndexType getIndexType(Target target) {
329329
}
330330

331331
// OR queries have more than one sub-target (one sub-target per DNF term). We currently consider
332-
// all OR queries to have partial indexes, and hence do sorting and limit in post-processing.
332+
// OR queries that have a `limit` to have a partial index. For such queries we perform sorting
333+
// and apply the limit in memory as a post-processing step.
333334
// TODO(orquery): If we have a FULL index *and* we have the index that can be used for sorting
334335
// all DNF branches on the same value, we can improve performance by performing a JOIN in SQL.
335336
// See b/235224019 for more information.
336-
if (subTargets.size() > 1 && result == IndexType.FULL) {
337+
if (target.hasLimit() && subTargets.size() > 1 && result == IndexType.FULL) {
337338
return IndexType.PARTIAL;
338339
}
339340

0 commit comments

Comments
 (0)