couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Cohnen <sebastiancoh...@googlemail.com>
Subject Re: Short ids in url.
Date Mon, 19 Apr 2010 12:57:06 GMT
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).
 


On 19.04.2010, at 14:48, faust 1111 wrote:

> is it possible send couch like /_uuids?count=10
> and its return me  short ids?
> 
> 2010/4/19 faust 1111 <faust451@gmail.com>:
>> I need autogenerated short ids.
>> i try use rand(99999999) is it fine?
>> 
>> 2010/4/19 David Coallier <david.coallier@gmail.com>:
>>> On 19 April 2010 11:19, faust 1111 <faust451@gmail.com> wrote:
>>>> yes i know that i can create my own ids
>>>> but i am interesting in what way couch guy's solve this.
>>>> 
>>> 
>>> 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 :)
>>> 
>>> 
>>> 
>>> --
>>> David Coallier
>>> 
>> 


Mime
View raw message