Potentially unexpected scans with compound indexes when some fields are multikey

XMLWordPrintableJSON

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

      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.

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

                Created:
                Updated:
                Resolved: