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

Wrong index is being used, causing inefficient queries

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.6.4
    • None
    • Querying
    • None
    • ALL

    Description

      I have a collection with two fields. One is a string and another is an ObjectId.
      I have indices on both fields.
      When doing a query such as {'string_field' : 'some value', 'other_obj_id' : {$exists : true}}, the index used for the query is consistently the one on 'other_obj_id' and not the one on 'string_field', although that one would be much faster.

      This staretd to happen as soon as I've upgraded to 2.6.4 and is a degradation from 2.6.1 !

      Attachments

        Issue Links

          Activity

            People

              ramon.fernandez@mongodb.com Ramon Fernandez Marina
              baruchoxman Baruch Oxman
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: