Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-558

Optimize SORT + LIMIT

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Core
    • None

      Idea: We should optimize queries that use SORT followed by LIMIT.

      The speed of queries with SORT + LIMIT is important, as it is often used to generate a presentation which has to fit in limited space, e.g. a screen.

      The current implementation strictly searches, then sorts EVERYTHING FOUND, then returns the first LIMIT entries. We should change this to insertion during search into a sorted array / structure with room for only LIMIT entries. This can dramatically speed up SORT + LIMIT in cases where the search result is larger than LIMIT. 

            Assignee:
            jorgen.edelbo@mongodb.com Jørgen Edelbo
            Reporter:
            finn.schiermer-andersen@mongodb.com Finn Andersen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: