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

Query optimizer should efficiently handle $in and sort with compound index.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 2.5.5
    • Querying

    Description

      Suppose you have an index on

      {friend_id: 1, date: -1}

      Then, suppose you have a query like this:

      db.things.find({ friend_id: {$in: [lots_of_ids]}}).sort(

      {date: -1}

      ).limit(20)

      Currently, this does a scanAndOrder and scans quite a few documents. Can we optimize?

      Attachments

        Issue Links

          Activity

            People

              Votes:
              51 Vote for this issue
              Watchers:
              62 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: