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

Query optimizer should always use equality predicate over unique index when possible

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.8, 3.0.0-rc6
    • Affects Version/s: 2.6.5
    • Component/s: Querying
    • None
    • Fully Compatible
    • ALL

      After upgrading sharded cluster (shard key {uid:1}) from 2.4.9 to 2.6.5 I've began to notice periodic and sudden significant performance drops caused by huge read queue and lock on different shards. Logs shows slow queries like this:

      <skpd> query mpfs.hidden_data query: { _id: "5120d6d1c7624f319c35fdff9e596890", uid: "230984277" } planSummary: IXSCAN { uid: 1.0 } ntoskip:0 nscanned:28184 nscannedObjects:28184 keyUpdates:0 numYields:220 locks(micros) r:797191 nreturned:1 reslen:374 7134ms

      This collection has indexes {uid: 1} and {_id: 1}, and in normal situation, queries like that uses "_id" index that is the fastest one.

      This problem seems to be very similar to SERVER-13675 but it's marked as fixed in 2.6.2.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            miga Migalin Danila
            Votes:
            8 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved: