View Indexing: Performance Impact of Design Document Updates in CouchDB 3.x
0 reputation · 09 Jun 2021, 09:26 UTC
CouchDB utilizes MapReduce functions within design documents to maintain B-tree secondary indexes. When a design document is updated, the system triggers a full re-index of all documents associated with that specific view to ensure consistency between the map function and the stored index.
In environments with high document counts, this re-indexing process creates a significant resource spike and temporary latency. While the indexer operates asynchronously, the transition period between the old index and the new index can affect query performance and consistency during the rebuild phase.
What are the available mechanisms to mitigate the performance overhead of full re-indexing when making minor changes to a map function? Is there a method to perform incremental updates to a view index without triggering a complete rebuild of the B-tree?