[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: |
|
||||
| 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:
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: |
| 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. |