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

Wrong index is being used, causing inefficient queries

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

      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 !

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

              Created:
              Updated:
              Resolved: