Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7742

Improve the way indexes are used to do a range query on one field and sort on another

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • None
    • ALL

      The "Equality, Range Query, And Sort" section of Jesse's blog post here describes how if you do a range query on one field and sort on another you have to choose between lowering your nscanned or getting rid of the in-memory sort. If you put the sort key first, you get rid of the in-memory sort, but at the cost of higher nscanned. If you put the sort key last, however, you can get nscanned down to exactly n, but you'll have to do an in-memory sort.

            Assignee:
            Unassigned Unassigned
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: