apache / apache/couchdb

Covering indexes for Mango JSON indexes

Open
#4,413 0 comments 0 reactions 1 assignee Claimed by @pgj View on GitHub
api enhancement mango
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

[NOTE]: # ( ^^ Provide a general summary of the request in the title above. ^^ )

## Summary

Provide the ability for Mango to answer a query only using an index, when that index contains all fields needed by a query.

This should speed up these queries significantly -- PoC benchmarks indicate 2-5x speedups dependent on the number of documents that need to be read from primary data. (5x seen at p90 response times between 100 and 500 documents read from primary data for a simple one-field query, on a 2022 MacBook Pro using k6.io).

## Desired Behaviour

Described in https://github.com/apache/couchdb/pull/4410.

## Possible Solution

Described in https://github.com/apache/couchdb/pull/4410.

## Additional context

None needed beyond RFC.

## General PRs

- [x] JSON index selection tests (`mango_cursor_view:choose_best_index/2`)
- [x] Add `index_rows_read` into mango execution stats.
- [x] Keys only covering index.
- [ ] Add support to index definitions to write values to JSON indexes.
- Potentially iterate several PRs to add the restrictions and the metrics.
- [ ] Add support for using index values in covering indexes.
- [x] Inform user of covering index use in `_explain`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.