Skip to content

sqlite adapter does not use indexes correctly #8631

Description

we are using the sqlite premium adapter and encountered an issue with $in queries that contain multiple values.

It seems in this case the rxdb query planner will not use the index and the query times out (on large datasets > 1 mil documents).

we work around this by separating queries with $in >= 1 into multiple queries, which can use the index, and then merge everything together at the end. but the best thing to do might be to let sqlite handle this.

would it be possible to improve $in handling in the sqlite-premium plugin?

example:

collection.find({
  selector: {
    name: { $in: ['aaron', 'jack', 'carol'] },
    age: { $lt: 5 },
  },
  sort: [{ age: 'desc' }],
  limit: 50,
  index: ['name', 'age'],
}).exec()

this is when implementing a sortable filterable table with pagination on a collection.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions