The $in operator in _find makes the queries very slow
- Dominant language
- Erlang
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 9
Description
## Expected Behavior
First of all, I am a programmer from China. Here are my questions:
`{
"limit": 20,
"skip": 0,
"fields": [
"_id",
"fid",
"_rev",
"name",
"des",
"type",
"fname",
"extension",
"mtime",
"uid",
"icon"
],
"selector": {
"$and": [
{
"fid": {
"$in": [
3692398112768,
3701629775872,
3727986782208,
3781082476544,
3805799510016,
3841321070592,
3849785176064,
3695615143936,
3698387578880,
3721196204032,
3777047556096,
3785226448896,
3813181485056,
3831992938496,
3853979480064
]
}
}
]
},
"execution_stats": true
}`
The index has been established,But when the query, it doesn't seem to work?
"execution_stats": {
"total_keys_examined": 0,
"total_docs_examined": 2935,
"total_quorum_docs_examined": 0,
"results_returned": 15,
"execution_time_ms": 9942.517
}
A total of 15 records, using nearly 10 seconds,Did I do something wrong?
Contributor guide
Research direction
Start by reproducing the reported _find query with its $in selector and execution_stats enabled. Investigate why the existing index examines zero keys while 2,935 documents are scanned, then compare the execution statistics after the query behavior is addressed; done means the 15-result query no longer takes nearly 10 seconds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- erlang
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100