couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wout Mertens <wout.mert...@gmail.com>
Subject Re: Is speed falls on dynamic views?
Date Sun, 19 Apr 2009 16:33:35 GMT
On Apr 19, 2009, at 1:56 PM, Elf wrote:

> So, i have something like in view:
>
> if (doc.date_check < (new Date().getTime()/1000 - 2*60*60)) {
>      emit('not checked', 1);
> }
>
> As I understand, it's impossible to cache this view results, so this
> view must be recounted on every call.
> Am i right?

No.

This view will be calculated once and then the result is what it was  
until the document is changed and the view recalculated.

> Is there better idea to get document-level locking?

Instead of "moving the view" you should "move the viewer".

You should make a view showing only documents that are being worked on  
and emit the time at which work started. You can then get that view  
ordered in reverse, with the startkey set to to the time before which  
document processing should be retried.

Wout.

Mime
View raw message