Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

$in and $or too slow for large database (doesn´t use index)

Open
#5,189 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
erlang
Domain
databases

Research direction

Reproduce the selectors in Fauxton against a CouchDB 3.3.2 database with the described _id index and compare the behavior of $eq, $in, and $or. Trace Mango query planning and index selection to determine why the multi-value selectors do not complete; done means they use the available index and return the expected documents, with regression coverage.

Written by the indexing model from the issue text.

Description

bug needs-triage

My database has 4.7GB of data (3191269 docs)
Attribute _id has implicit index.

{
 "type": "special",
 "def": {
  "fields": [
   {
    "_id": "asc"
   }
  ]
 }
}

This selector works well:

{
   "selector": {
      "_id": {
         "$eq": "CustomerElastic_00001280-7a18-466b-9e9c-da5a2d903bda"
      }
   }
}

This selector is pending and never finished (the same when I use $or):

{
   "selector": {
      "_id": {
         "$in": ["CustomerElastic_00000a29-329f-477f-8d4a-8244a9c738aa", "CustomerElastic_00001280-7a18-466b-9e9c-da5a2d903bda"]
      }
   }
}

Why?

Steps to Reproduce

Use fauxton and mango query.

Expected Behaviour

It should work the same as $eq

Your Environment

{"couchdb":"Welcome","version":"3.3.2","git_sha":"11a234070","uuid":"ff2fae1b3089d86fd741e84a6e532eda","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

  • Browser name and version: Chrome latest version
  • Operating system and version: Windows 11
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 18h
Merged PRs (30d)
15

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/couchdb

All issues in apache/couchdb

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.