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

Wrong index is being used, causing inefficient queries

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.6.4
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      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

              Assignee:
              ramon.fernandez Ramon Fernandez Marina
              Reporter:
              baruchoxman Baruch Oxman
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: