Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 60609 invoked from network); 19 Apr 2010 12:57:37 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Apr 2010 12:57:37 -0000 Received: (qmail 62578 invoked by uid 500); 19 Apr 2010 12:57:36 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 62547 invoked by uid 500); 19 Apr 2010 12:57:36 -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 62539 invoked by uid 99); 19 Apr 2010 12:57:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Apr 2010 12:57:36 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebastiancohnen@googlemail.com designates 74.125.78.27 as permitted sender) Received: from [74.125.78.27] (HELO ey-out-2122.google.com) (74.125.78.27) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Apr 2010 12:57:31 +0000 Received: by ey-out-2122.google.com with SMTP id 4so383837eyf.41 for ; Mon, 19 Apr 2010 05:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=MBKDLwSq5i0kBebSxBgm23rnMrnaFjjH/jIljNAk8m0=; b=jMJwkpy9LiySDKd6nZKNMABUl2+X6QNIj8xoW7bHYQpzaEMjBobJOLKbgHpc0LbDja d/sAPBwkYzNu9/bAoMbtKEN1Yo1BJZ3/ZESPqSHJsLuCp6uCZLCWquWiiKg6XUeaOJEV LO2pkcqRFp9bhA5Gtab0hOS28+TxQt3zmRfQg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=LUv+hnGrRSLDe62Y35N8fxbA011i3A16TN5jcXAuMLDLqnIxyD2C8dBdfrXV4wkWa2 gpRPIIjw6pZUj+wk/545lWN4sjKbIzhBVhf9NDES8WWHZLZXnVAgWS7hM8MH5UlUeLSV P/nyZg8g9KAIByhpJKLCl1EnU9zNk7+71iPYU= Received: by 10.213.47.195 with SMTP id o3mr2361286ebf.48.1271681827817; Mon, 19 Apr 2010 05:57:07 -0700 (PDT) Received: from [192.168.0.152] (xdsl-78-35-70-42.netcologne.de [78.35.70.42]) by mx.google.com with ESMTPS id 15sm3715638ewy.0.2010.04.19.05.57.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 19 Apr 2010 05:57:07 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1078) Subject: Re: Short ids in url. From: Sebastian Cohnen In-Reply-To: Date: Mon, 19 Apr 2010 14:57:06 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <7792D43A-DDDB-4289-9E85-57F4637C3AB2@googlemail.com> References: To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1078) no, UUIDs need to be as unique as possible. couchdb's _uuid API = guarantees a high entropy for the produced IDs. the problem with (short) = numeric IDs is, that they are more likely to produce collisions. if you = do not use replication, you can basically do this: 1) create a number on your client 2) try to insert your document using this id 3) if you get a conflict, goto 1) 4) if your insert was successful, you are done. the fundamental flaw to this approach is, that you more likely get = conflicts when using replication (the shorter the IDs are, the more = likely of course, see = http://en.wikipedia.org/wiki/Birthday_attack#The_mathematics). =20 On 19.04.2010, at 14:48, faust 1111 wrote: > is it possible send couch like /_uuids?count=3D10 > and its return me short ids? >=20 > 2010/4/19 faust 1111 : >> I need autogenerated short ids. >> i try use rand(99999999) is it fine? >>=20 >> 2010/4/19 David Coallier : >>> On 19 April 2010 11:19, faust 1111 wrote: >>>> yes i know that i can create my own ids >>>> but i am interesting in what way couch guy's solve this. >>>>=20 >>>=20 >>> Right... I'm not sure I exactly understand what you mean. Do you = mean >>> how could one do that from within CouchDB using autogenerated IDs or >>> using something like "io" (http://github.com/janl/io) which is a = short >>> url generator using CouchDB :) >>>=20 >>>=20 >>>=20 >>> -- >>> David Coallier >>>=20 >>=20