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

Make call to `getKeys` in `IndexAccessMethod::findSingle` faster

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.0-rc2
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • Query 2016-10-31
    • 0

      The call to `getKeys` in `IndexAccessMethod::findSingle` is very costly, causing a 2-5% reduction in the humber of ops per second for simple update queries.

      To test this, I ran microbenchmarks comparing a recent master commit (b4d550) to the same code but without the call to `getKeys`, yielding the following results:

      Storage Engine # threads increase in ops/second
      mmapv1 1 2.07%
      mmapv1 2 3.68%
      mmapv1 4 5,10%
      mmapv1 8 5,70%
      wiredTiger 1 2.38%
      wiredTiger 2 2.82%
      wiredTiger 4 2.30%
      wiredTiger 8 3.07%

      Simply removing the call will not suffice, as it is needed for when there are non-default collations on the _id field. geert.bosch suggested that implementing a cheap way to check if there is a non-default collation on the _id (possible by either adding a boolean field somewhere that keeps track fo this or by iterating over the indexes to check) would make it possible to avoid the call in the cases where it isn't necessary.

            Assignee:
            marko.vojvodic@mongodb.com Marko Vojvodic
            Reporter:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: