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

Potentially unexpected scans with compound indexes when some fields are multikey

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.2.2
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Lets say you are querying for { a:{ $gt:10, $lt:20 } }

      and you have an index on a, b

      If b is multikey, the query optimizer will scan a much wider range of index and it will have to scan the objects to complete query evaluation. This is because the optimizer doesn't know if all the values of a are scalar; if they are not a document like { _id:2, { a:[ 5, 25 ] } } would match the query.

      This makes the advice that an index on a is not needed if you have an index on a, b incorrect and makes performance optimization confusing.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hari.khalsa@10gen.com hari.khalsa@10gen.com
              Reporter:
              max@10gen.com Max Schireson
              Participants:
              Votes:
              13 Vote for this issue
              Watchers:
              13 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: