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

Potentially unexpected scans with compound indexes when some fields are multikey

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.2.2
    • Querying
    • None
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: