Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you Schedule Index Updates in CouchDB

As far as I understand, CouchDB indexes are updated when a view is queried. Assuming there are more reads than writes, isn't this bad for scaling? How would I configure CouchDB to update indexes on writes, or better yet, on a schedule?

like image 494
Jonathan Tran Avatar asked Sep 23 '08 16:09

Jonathan Tran


1 Answers

CouchDB does regenerate views on update, but only on what has changed since the last read access to the view. Assuming your read volume greatly outweighs your write volume, this shouldn't be a problem.

When you're changing large numbers of documents at once this could lead to the possibility of the first read requests taking a noticeable amount of time. To alleviate this a few different possibilities have been suggested. Most rely on registering with CouchDB's update notifications and triggering reads automatically.

An example script for doing exactly that is available on the CouchDB wiki at [1].

[1] http://wiki.apache.org/couchdb/RegeneratingViewsOnUpdate

like image 165
Paul J. Davis Avatar answered Sep 23 '22 03:09

Paul J. Davis