[SERVER-45763] Optimize extractKeyFast() fallback path Created: 24/Jan/20  Updated: 29/Oct/23  Resolved: 01/Apr/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.4.0-rc0, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Justin Seyster Assignee: Ian Boros
Resolution: Fixed Votes: 0
Labels: qexec-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Duplicate
is duplicated by SERVER-43993 Improve Document memory usage during ... Closed
Problem/Incident
Related
related to SERVER-67709 eliminate `visit_helper` namespace Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Query 2020-03-23, Query 2020-04-06
Participants:
Linked BF Score: 0

 Description   

The SortKeyGenerator::extractKeyFast checks to see if a path in the sort key traverses any array, and if an array is found, it returns failure so that the caller can use the slower path that supports array traversal.

Simply checking the array path, though, triggers a conversion for fields in the input Document, so that they can reside in the Document's Value cash. That conversion is expensive if there are large documents or arrays along the path, and all that work gets thrown away if an array is encountered anywhere along the path: the "slow" path operates on the underlying BSON and gets no benefit from the cached Values.

We could speed up some queries if we had a way to perform the check in extractKeyFastPath() without doing any BSON -> Value conversions.



 Comments   
Comment by Githook User [ 02/Apr/20 ]

Author:

{'name': 'Ian Boros', 'email': 'ian.boros@mongodb.com', 'username': 'puppyofkosh'}

Message: SERVER-45763 optimize sort key generation

(cherry picked from commit 5557279e9ca9c78fbeb1026fc1a48a5c7c334b71)
Branch: v4.4
https://github.com/mongodb/mongo/commit/41710b8842747067e82f1ac3cc46acd4fab75008

Comment by Githook User [ 01/Apr/20 ]

Author:

{'name': 'Ian Boros', 'email': 'ian.boros@mongodb.com', 'username': 'puppyofkosh'}

Message: SERVER-45763 optimize sort key generation
Branch: master
https://github.com/mongodb/mongo/commit/5557279e9ca9c78fbeb1026fc1a48a5c7c334b71

Generated at Thu Feb 08 05:09:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.