incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kerr Rainey <>
Subject Re: Thoughts on document/views...
Date Thu, 12 Feb 2009 11:23:03 GMT
2009/2/11 kowsik <>:
>  I have views that do something like this:
> map: function(doc) {
>    if (doc.type == 'comment') emit(...);
> }
> With a large set of documents and a large set of views, any new
> document or updates to document is passed to __all__ of the views
> (when the view is eventually invoked). But I "know" that my documents
> come in classes and that only certain views really apply to them. I'm
> thinking of a view as a static method on a class that gets some
> information about the instances.

Just in case anyone is interested, Notes Domio has an optimisation
feature that does this.  In Notes Domino views the selection formula
is very often of the form:

SELECT Form="Foo" AND ...

Every document (ok, almost all documents) in an ND db has a field
"Form" that controls various built in behaviour.  Typically this does
not change and since most views are based on the form, there is an
optimisation to be made.  When the option is turned on, only documents
with the relevant forms are sent to the view indexer when required.
The main beneficiaries of this optimisation is when you have a number
of views that will contain a small number of docs out of a very large
number of docs in the whole database.  If for some reason these
indexes get discarded they can be rebuilt in a fraction of the time it
would otherwise take; minutes instead of hours.

This is definitely a useful optimisation in ND, but there may be
better ways to architect your solution in CouchDB than you can in ND,
possibly making that optimisation unnecessary.


View raw message