couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Every view has to be run on every record?
Date Fri, 28 Jan 2011 21:23:35 GMT
On Fri, Jan 28, 2011 at 4:05 PM, George Burt <imtrueshot@gmail.com> wrote:
> Does every change to a view require a view update for every single document?
>
> I was watching a youtube video and someone (I think it was Jan) said there
> was a couchdb that had "millions of databases".  Someone in the chat asked
> for clarification, and he repeated it.  It got me thinking about
> reorganizing my project and combining what was many couchdb databases into a
> single database.  But if there is no way to convince a view change that it
> need only evaluate a subset of documents, then this approach has to be
> totally static in structure.
>
>    "all": {
>      "map": "function(doc) { if (doc.Type == 'customer')  emit(null, doc) }"
>    }
>
> If you were to change the emit to being something different, but the if
> (doc.Type=='customer') part stayed the same, do you really have crawl every
> record to rebuild an index when the index already knows which documents are
> relevant?
>
> Thanks,
>
> George
>

Yes, with caveats. In your proposed example, doing it any other way
would require us to do some sort of complex and (to me at least) as
yet unknown static analysis of JavaScript source code. Ie, not really
doable.

On the flip side, there was an attempt at one point at implementing
filters which were simplified tests like "doc.type == 'customer'" or
similar that would run in Erlang before the doc was passed to the view
engine, in essence skipping a lot of the work that the view engine
would require. These never really got developed enough to be generally
useful as well as being mostly a hack in the name of performance.

Mime
View raw message