[SERVER-26429] Make call to `getKeys` in `IndexAccessMethod::findSingle` faster Created: 30/Sep/16  Updated: 31/Oct/16  Resolved: 24/Oct/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.4.0-rc2

Type: Improvement Priority: Major - P3
Reporter: Samuel Rossi (Inactive) Assignee: Marko Vojvodic
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Sprint: Query 2016-10-31
Participants:
Linked BF Score: 0

 Description   

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.



 Comments   
Comment by Githook User [ 24/Oct/16 ]

Author:

{u'username': u'm-vojvodic', u'name': u'Marko Vojvodic', u'email': u'marko.vojvodic@mongodb.com'}

Message: SERVER-26429 Optimize IndexAccessMethod::findSingle to only call getKeys() if needed
Branch: master
https://github.com/mongodb/mongo/commit/f73b79d7604b7b6ebd095f729b37642509580a6c

Comment by David Storch [ 03/Oct/16 ]

Looks like we should be able to check whether or not the index has a non-simple collation by having the IndexAccessMethod check whether the CollatorInterface on its IndexCatalogEntry is non-null. IndexAccessMethod keeps a pointer to its corresponding IndexCatalogEntry in IndexAccessMethod::_btreeState.

Generated at Thu Feb 08 04:12:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.