From user-return-23918-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Fri Mar 15 02:24:31 2013 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13F5ADF64 for ; Fri, 15 Mar 2013 02:24:31 +0000 (UTC) Received: (qmail 87365 invoked by uid 500); 15 Mar 2013 02:24:29 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 87325 invoked by uid 500); 15 Mar 2013 02:24:29 -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 87317 invoked by uid 99); 15 Mar 2013 02:24:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 02:24:29 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [128.18.84.133] (HELO brightmail-internal4.sri.com) (128.18.84.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 02:24:24 +0000 X-AuditID: 80125485-b7fc16d00000612f-d5-514286438aad Received: from exchange-hub02.SRI.COM (exchange-hub02.SRI.COM [128.18.23.154]) (using TLS with cipher AES128-SHA (AES128-SHA/128 bits)) (Client did not present a certificate) by brightmail-internal4.sri.com (SRI Internal SMTP Gateway) with SMTP id 6C.64.24879.34682415; Thu, 14 Mar 2013 19:24:03 -0700 (PDT) Received: from EXCHANGE-DB08.SRI.COM ([fe80::a11e:7c21:6886:9a20]) by exchange-hub02.SRI.COM ([fe80::f097:c52f:a570:8336%12]) with mapi id 14.02.0298.004; Thu, 14 Mar 2013 19:24:00 -0700 From: Jim Klo To: "" Subject: Re: Tracking doc access Thread-Topic: Tracking doc access Thread-Index: AQHOIRgA4u0eQdz1X0yL+QTm+J7jL5imeHAAgAADCoA= Date: Fri, 15 Mar 2013 02:23:59 +0000 Message-ID: <77EB5C58-064A-4E32-A79F-622740C08253@sri.com> References: <514271C0.3080806@bardubitzki.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [192.12.16.226] Content-Type: multipart/signed; boundary="Apple-Mail=_99436A95-FA6F-4976-A529-26740344E661"; protocol="application/pkcs7-signature"; micalg=sha1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsXSICQ+S9e5zSnQYE2HkUXnnr1sDoweGz8c ZwxgjOKySUnNySxLLdK3S+DKeHT/JmtBX3bFybdH2BoYFyR2MXJwSAiYSHz8Y9HFyAlkiklc uLeerYuRi0NIYCeTxLHm60wQzj5GiY/797OAVLEJyEsc3v6AGcQWEbCUuLXgI1hcWEBB4tPe BywQcUWJ5Ts+sEHYVhKnl65hBbFZBFQlJs5dD1bDCxQ/dnodO4gtJBAvcWfdYSYQm1PAWuL3 y1lg9YxAF30/tQYsziwgLnHryXwmiEtFJB5ePM0GYYtKvHz8jxXCVpRY1/SXHaJ+CqPEq25V iF2CEidnPmGZwCgyC8moWUjKZiEpg4gnSUza/JsVwtaWWLbwNTOEbSDxtPMVFnF9iTfv5kDN NJV4ffQjI4RtLTHj10E2CFtRYkr3Q/YFjNyrGGWSijLTM0pyEzNzdGHRaaJXXJSpl5yfu4kR HLEhrTsYV+wxPMQowMGoxMM787FjoBBrYllxZe4hRgkOZiUR3l1/gUK8KYmVValF+fFFpTmp xYcYpTlYlMR5v5nz+wsJpCeWpGanphakFsFkmTg4pRoYGyvLbQWWRu88eSM2ZrG425Kjr94t 1Jj+4+q5uc+ZZSJVFUOOvdgU737ptbLN7bYT96/ftfWQ0Tx26P4U/WVOj6cwq4oUu73XToxi Ya11ODh35abkLe/jRT1Sk7I/TWNjKrZbwS8ldp4zu0gsbufbPzt6IlvamdfNVzqs9MDm3G2W N4vCErZfVmIpzkg01GIuKk4EAKJ3r7vUAgAA X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_99436A95-FA6F-4976-A529-26740344E661 Content-Type: multipart/alternative; boundary="Apple-Mail=_3E50B4A5-194E-4D14-B0E4-83C629F6448B" --Apple-Mail=_3E50B4A5-194E-4D14-B0E4-83C629F6448B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 One more thing=85 inserting new doc is also not prone to document = conflicts since you're not updating a document when logging access from = multiple threads. - JK On Mar 14, 2013, at 7:13 PM, Jim Klo wrote: > I think you'd be better off tracking access by inserting an immutable = document with a new timestamp and doc._id of the accessed document. >=20 > You could then create a view that 'joined' the timestamp doc with real = doc, by emiting timestamp as key and { _id: accessed_doc._id } as the = value then requesting with_docs=3Dtrue if I remember correctly=85=20 >=20 > Updating doc to append a timestamp would be inherently slow if you = have a high volume of repeat access and cause your views to consistently = have to update=85 >=20 > just my 2=A2 >=20 > - Jim >=20 > Jim Klo > Senior Software Engineer > Center for Software Engineering > SRI International > t. @nsomnac >=20 > On Mar 14, 2013, at 5:56 PM, Stephan Bardubitzki = > wrote: >=20 >> Hi there, >>=20 >> I have a task where I need to track how often a doc is accessed. The = two possible ways I can think of are: >>=20 >> 1. add an array to the doc and add the timestamp when it is accessed >> 2. create a new document and add the doc._id and the timestamp >>=20 >> Which one would you prefer? Or is there a better solution? >>=20 >> Thanks, >> Stephan >>=20 >=20 --Apple-Mail=_3E50B4A5-194E-4D14-B0E4-83C629F6448B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 One = more thing=85 inserting new doc is also not prone to document conflicts = since you're not updating a document when logging access from multiple = threads.

- JK

On Mar 14, 2013, at 7:13 PM, Jim Klo <jim.klo@sri.com>
 wr= ote:

I = think you'd be better off tracking access by inserting an immutable = document with a new timestamp and doc._id of the accessed = document.

You could then create a view that 'joined' = the timestamp doc with real doc, by emiting timestamp as key and { _id: = accessed_doc._id } as the value then requesting with_docs=3Dtrue if I = remember correctly=85 

Updating doc to = append a timestamp would be inherently slow if you have a high volume of = repeat access and cause your views to consistently have to = update=85

just my 2=A2

-= Jim

Senior Software = Engineer
Center for Software = Engineering
SRI = International
t. = @nsomnac

On Mar 14, 2013, at 5:56 PM, Stephan Bardubitzki <stephan@bardubitzki.com>
 wrote:

Hi = there,

I have a task where I need to track how often a doc is = accessed. The two possible ways I can think of are:

1. add an = array to the doc and add the timestamp when it is accessed
2. create = a new document and add the doc._id and the timestamp

Which one = would you prefer? Or is there a better = solution?

Thanks,
Stephan



= --Apple-Mail=_3E50B4A5-194E-4D14-B0E4-83C629F6448B-- --Apple-Mail=_99436A95-FA6F-4976-A529-26740344E661 Content-Disposition: attachment; filename="smime.p7s" Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJ/zCCBO0w ggRWoAMCAQICEDJaYyWeLlo372z82sws71YwDQYJKoZIhvcNAQEFBQAwgdgxCzAJBgNVBAYTAlVT MRowGAYDVQQKExFTUkkgSW50ZXJuYXRpb25hbDEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0 d29yazE7MDkGA1UECxMyVGVybXMgb2YgdXNlIGF0IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9y cGEgKGMpMDIxMDAuBgNVBAsTJ0NsYXNzIDIgT25TaXRlIEluZGl2aWR1YWwgU3Vic2NyaWJlciBD QTEdMBsGA1UEAxMUU1JJIEludGVybmF0aW9uYWwgQ0EwHhcNMTIxMjIyMDAwMDAwWhcNMTMwNjIw MjM1OTU5WjCBwjEaMBgGA1UEChQRU1JJIEludGVybmF0aW9uYWwxKDAmBgNVBAsUH0luZm9ybWF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