incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elf <elf2...@gmail.com>
Subject Re: Is speed falls on dynamic views?
Date Sun, 19 Apr 2009 17:46:45 GMT
2009/4/19 Wout Mertens <wout.mertens@gmail.com>:
> 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.

So, only first view calculating will be correct (new Date() returns
current date) and all next calls to this view will return incorrect
rows (because of outdate new Date() value in a view)?


>> 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.

Elegantly, thanks for idea!


-- 
----------------
Best regards
Elf
mailto:elf2001@gmail.com

Mime
View raw message