3.11. Background Indexing

Secondary indexes in CouchDB are not updated during document write operations. In order to avoid high latencies when reading indexes following a large block of writes, CouchDB automatically kicks off background jobs to keep secondary indexes “warm”. The daemon responsible for this process is internally known as “ken” and can be configured using the following settings.

[ken]
batch_channels

This setting controls the number of background view builds that can be running in parallel at any given time. The default is 20.

incremental_channels

It is possible for all the slots in the normal build system to be occupied by long-running index rebuilds (e.g. if new design documents are posted to several databases simultaneously). In order to avoid already-built indexes from falling behind when this occurs, CouchDB will allow for a number of short background indexing jobs to run even when all slots are full. This setting controls how many additional short jobs are allowed to run concurrently with the main jobs. The default is 80.

max_incremental_updates

CouchDB estimates whether an indexing job is “incremental” or not by looking at the difference in sequence numbers between the current index and the main database. If the difference is larger than the threshold defined here the background job will only be allowed to run in the main queue. Defaults to 1000.

[ken.ignore]

Entries in this configuration section can be used to tell the background indexer to skip over specific database shard files. The key must be the exact name of the shard with the .couch suffix omitted, for example:

[ken.ignore]
shards/00000000-1fffffff/mydb.1567719095 = true

Note

In case when you’d like to skip all views from a ddoc, you may add autoupdate: false to the ddoc. All views of that ddoc will then be skipped.

More at PUT /{db}/_design/{ddoc}.