-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
3 - M (<= 1 month)
-
Differentiators
-
2545
Goals
It is sometimes natural to want the "Top 5" and "Bottom 5" results. As someone coming from other databases, it seemed natural to run a single sorted query, then slice the beginning and end of the list.
Expected Results
The retrieval time of both chunks should be fast.
Actual Results
In reality, it seems like the end slice is doing a scan through the entire result set. I've worked around this by doing two queries with opposite sorts, but it was surprising behaviour to me.
Steps to Reproduce
Reproduction is here: https://github.com/thekevinbrown/realm-js-slow-writes
Code Sample
Reproduction is here: https://github.com/thekevinbrown/realm-js-slow-writes
Version of Realm and Tooling
- Realm JS SDK Version: 2.29.2
- Node or React Native: 0.59.10
- Client OS & Version: Android, Galaxy S9
- Which debugger for React Native: None, reproduced in release mode.
Note
This issue was originally raised as #2499, I'm splitting it out because multiple separate and unconnected issues were discovered in exploring there.