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 61D8B10797 for ; Thu, 5 Dec 2013 23:15:29 +0000 (UTC) Received: (qmail 74466 invoked by uid 500); 5 Dec 2013 23:15:28 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 74429 invoked by uid 500); 5 Dec 2013 23:15:28 -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 74421 invoked by uid 99); 5 Dec 2013 23:15:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 23:15:27 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.192.173] (HELO mail-pd0-f173.google.com) (209.85.192.173) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Dec 2013 23:15:22 +0000 Received: by mail-pd0-f173.google.com with SMTP id p10so25610841pdj.32 for ; Thu, 05 Dec 2013 15:15:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:content-transfer-encoding :subject:message-id:date:to:mime-version; bh=kVYWZNaVeJ/jdATlLFskptpblYtPqz+o1ahFoks7w5o=; b=lIS4mQTPwjd2QBrWNg6Qukez6A9H9KVNY2lUc/zYluuO8lV8dKa5Y9CpCe0C2B7ngc FmbZ8qF1iM9j9ldP7ZLeRZxApgP5iN1sMk5iOwX+ufZycQRfCHLYu9DVpv8hmzwxC9OV QPjp45Qt6QF3GnavpqXWMEaHWr6mFT1OJ7E0GCepqkyl0ybN9y+uazuwBH1klR9QCOkq 2IKQaaT3SZ3TGcrMpjQDG3B0HcCf5r28mgQxTVP0aLnxRe4AXom7+vmm7RiWdMTvIxT5 JULRHpyqlzItADRLacidddV4XAQ1xmp2+59D7DuM49XBNgbgQiLstVOD7KRwqU6jHRt4 ZmtA== X-Gm-Message-State: ALoCoQlP2UX4JNb5XVGYsFNh/sLXlz7xz5DQFZWx9k3RR84gW4+Rk8pKb/rduax6uR9lDNELxroc X-Received: by 10.66.235.106 with SMTP id ul10mr260855pac.19.1386285301639; Thu, 05 Dec 2013 15:15:01 -0800 (PST) Received: from [192.168.1.112] (24-216-224-114.static.mdfd.or.charter.com. [24.216.224.114]) by mx.google.com with ESMTPSA id p1sm4541563pbo.12.2013.12.05.15.15.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 15:15:00 -0800 (PST) From: Nathan Vander Wilt Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Is startkey_docid as scalable as startkey? Message-Id: <7B540336-3CFA-4380-977E-2173BE7AD476@calftrail.com> Date: Thu, 5 Dec 2013 15:14:58 -0800 To: user@couchdb.apache.org Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) X-Mailer: Apple Mail (2.1822) X-Virus-Checked: Checked by ClamAV on apache.org Let's say for every doc I `emit([doc.user])` and, when a user requests a = document ID I have my middleware `GET = =85/docs_by_user?startkey=3D[req.user.name]&endkey=3D[req.user.name,{}]&in= clude_docs=3Dtrue&limit=3D1&startkey_docid=3Dreq.param.id`. I return the = row's doc or 404 if the range is empty. Basically I'm giving each user = read access to "their own" objects without having to give them their own = database. I'm wondering though, if `startkey_docid` is as scalable as `startkey` = itself. IIRC, the doc ids are simply a final extra group level = internally (clearly they determine sort order) but if this behaves more = like `&skip=3Dlots` instead, then of course relying heavily on the query = above would be something of an anti-pattern. (Bonuses: If this _is_ still a reasonable solution, I'm assuming I can't = simplify my emit/query to use `&key=3Dname&startkey_docid=3Did` right? = Alternatively, would it be more efficient but just-as-correct to emit = plain string keys and limit my range to = `&startkey=3Dname&endkey=3Dname+"\0"?) thanks, -natevw=