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 18:00:25 GMT
On Apr 19, 2009, at 7:46 PM, Elf wrote:

> 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)?

Yup... View functions have to be such that given a view function f and  
2 documents x and y, that if x == y then f(x) == f(y).

Wout.

Mime
View raw message