Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 38167 invoked from network); 19 Apr 2009 17:47:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Apr 2009 17:47:14 -0000 Received: (qmail 99202 invoked by uid 500); 19 Apr 2009 17:47:13 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 99111 invoked by uid 500); 19 Apr 2009 17:47:13 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 99101 invoked by uid 99); 19 Apr 2009 17:47:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2009 17:47:13 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of elf2001@gmail.com designates 72.14.220.158 as permitted sender) Received: from [72.14.220.158] (HELO fg-out-1718.google.com) (72.14.220.158) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2009 17:47:05 +0000 Received: by fg-out-1718.google.com with SMTP id l27so364465fgb.3 for ; Sun, 19 Apr 2009 10:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=v3XWQxYEqELVrnegbQpCyCqbnz05oGKbiB7Ap0B7Tmg=; b=SqkTEJBHXtd6Syl+veusRxt/tSlTuDiABMpV1E+WYv2uqHEOLoWnTI0DJGHD3nVUUy 3ADuybRHRRnaR7hfceRbgnJP5Ra4hEpHMQ9eO2pha+x/XhBGoOs2gyPGmwg3gRAtBIgQ soJdmVLNBEua6sgCWACH7a/Lw+eINc9TMOYjk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=urlviXtRYh40Y9OR2Tzifx5Z+mdD4ynm7/Fh996sp+XPYWHF9rXHBNBQLlXdEdR7FA wc/wvejTusBOFtReaCMuhPf8tC0qGy7GqwtUxjx3oiNcgJxlFUC0cgjmc1UmADHlVtBN eZqkkNehX6nTv1j56WUaScvDG7JaWRZ9dLmyE= MIME-Version: 1.0 Received: by 10.86.98.10 with SMTP id v10mr3433276fgb.36.1240163205161; Sun, 19 Apr 2009 10:46:45 -0700 (PDT) In-Reply-To: References: <4a29064f0904190456m124fc8den42fb55fa62c19068@mail.gmail.com> Date: Sun, 19 Apr 2009 20:46:45 +0300 Message-ID: <4a29064f0904191046p2e36f65fsee89bc2f45754981@mail.gmail.com> Subject: Re: Is speed falls on dynamic views? From: Elf To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 2009/4/19 Wout Mertens : > 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)) { >> =A0 =A0 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 unti= l > 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 an= d > emit the time at which work started. You can then get that view ordered i= n > reverse, with the startkey set to to the time before which document > processing should be retried. Elegantly, thanks for idea! --=20 ---------------- Best regards Elf mailto:elf2001@gmail.com