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

Index access stats should be recorded for $match & mapReduce

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Completed:
    • Steps To Reproduce:
      Hide

      Reproduction case for aggregation:

      db.test.drop();
      db.test.save({a: 1});
      db.test.ensureIndex({a: 1});
      db.test.aggregate([{$match: {a: 1}}]);
      var statsArr = db.test.aggregate([{"$indexStats": {}}]).toArray();
      for (var idx in statsArr) {
          var doc = statsArr[idx];
          if (doc.name === "a_1") {
              assert(doc.accesses.ops == 1);
          }
      }
      

      Show
      Reproduction case for aggregation: db.test.drop(); db.test.save({a: 1}); db.test.ensureIndex({a: 1}); db.test.aggregate([{$match: {a: 1}}]); var statsArr = db.test.aggregate([{"$indexStats": {}}]).toArray(); for (var idx in statsArr) { var doc = statsArr[idx]; if (doc.name === "a_1") { assert(doc.accesses.ops == 1); } }
    • Sprint:
      QuInt E (01/11/16), Query F (02/01/16)

      Description

      Index access stats, retrievable via the $indexStats aggregation source, track the number of times a given index was used to satisfy a user operation.

      $match as a document source in aggregation can make use of indexes to retrieve documents but is currently not recording usage statistics. Support should be added for $match as exclusion could lead to the wrong conclusion as to whether an index is being used.

      Also missing is a hook to record index access when a mapReduce uses an index to satisfy a "query" argument. This issue will add support for both aggregation and mapReduce.

        Issue Links

          Activity

          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

          Message: SERVER-22048 Record index access stats for aggregation and mapReduce
          Branch: master
          https://github.com/mongodb/mongo/commit/176fad1a68fd9d0750a3aa4b33c2eb20be7d39ec

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'} Message: SERVER-22048 Record index access stats for aggregation and mapReduce Branch: master https://github.com/mongodb/mongo/commit/176fad1a68fd9d0750a3aa4b33c2eb20be7d39ec
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

          Message: SERVER-22048 Add index stats test covering multiple potential plan match
          Branch: master
          https://github.com/mongodb/mongo/commit/c8bc89143725e9c88bb80ca84a261024e170dc50

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'} Message: SERVER-22048 Add index stats test covering multiple potential plan match Branch: master https://github.com/mongodb/mongo/commit/c8bc89143725e9c88bb80ca84a261024e170dc50
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

          Message: SERVER-22048 Record index access stats for aggregation and mapReduce

          (cherry picked from commit 176fad1a68fd9d0750a3aa4b33c2eb20be7d39ec)
          Branch: v3.2
          https://github.com/mongodb/mongo/commit/fb79259aa514aab9682328fc430e1a833d808baf

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'} Message: SERVER-22048 Record index access stats for aggregation and mapReduce (cherry picked from commit 176fad1a68fd9d0750a3aa4b33c2eb20be7d39ec) Branch: v3.2 https://github.com/mongodb/mongo/commit/fb79259aa514aab9682328fc430e1a833d808baf
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

          Message: SERVER-22048 Add index stats test covering multiple potential plan match

          (cherry picked from commit c8bc89143725e9c88bb80ca84a261024e170dc50)
          Branch: v3.2
          https://github.com/mongodb/mongo/commit/ee3f14ec31f9a0f0bed04adfc08393f9a23f97f6

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'} Message: SERVER-22048 Add index stats test covering multiple potential plan match (cherry picked from commit c8bc89143725e9c88bb80ca84a261024e170dc50) Branch: v3.2 https://github.com/mongodb/mongo/commit/ee3f14ec31f9a0f0bed04adfc08393f9a23f97f6

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                  Agile