[SERVER-4207] $in queries perform linearly to the length of the input array Created: 03/Nov/11  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Performance, Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 5
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-6506 avoid checking for match of a full do... Closed
Assigned Teams:
Query Execution
Participants:

 Description   

If you do a $in or $nin query and give it a large array as input, then for each document that needs to be checked to see if it matches the query, it compares the value in that document for that field to each element in the input array. It would be much more performant if there was a single check to see if the value in the document is contained in a hash set of the values passed to the $in query.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 15/Mar/12 ]

@remon - can you send an example?
things aren't really linear - should be log(n)

Comment by Remon van Vliet [ 07/Mar/12 ]

This issue is becoming a real issue for me. We have to find all kinds of workarounds to avoid the straightforward use-case of large $in queries. The fix sounds pretty trivial. Is there any reason why this isn't planned to a specific version? What's "Planning Bucket B"?

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