On Tue, Apr 22, 2014 at 6:48 PM, Richard Hipp <[email protected]> wrote:

> On Tue, Apr 22, 2014 at 12:37 PM, Neville Dastur
> <[email protected]>wrote:
> > On 22 Apr 2014, at 17:33, Richard Hipp <[email protected]> wrote:
> > > Use the small integer "id" value for internal foreign keys and whatnot.
> > > And use the guid_id table to map GUIDs to id when moving data in from
> and
> > > out to the rest of the world.
> >
> > Sorry, but does this not just over complicate the problem.
>
>
> I guess it depends on the problem.
>
> The same idea is used in the schema for Fossil (http://www.fossil-scm.org/
> )
> and it works quite well there.   But every problem is different.  It's an
> engineering judgement.
>

To amend that a bit: being an active contributor to Fossil, i can attest
(from porting Fossil to libfossil), that this approach is not all that
memory-efficient. Fossil resp. libfossil allocate absolute boatloads of
memory for other purposes, though, so the cost of allocating UUIDs is a
drop in the bucket for that particular project/problem. For certain
applications i can imagine this might be a notable cost. (But also very
possibly swamped by the cost of using a db in the first place.)



> Fossil generates some of its "GUID"s using the SHA1 hash algorithm.  Other
> GUIDs (for example for ticket IDs) are generated using:
>
>         SELECT lower(hex(randomblob(20)));
>
> You can increase the 20 to make the GUIDs as "globally unique" as you
> want.  The GUIDs discussed previously in this thread seem use 16 instead of
> 20 and thus are less unique.
>

That reminds me of a specific snippet from this article:

http://www.w3.org/DesignIssues/Axioms.html#nonunique

In summary: the context of a GUID defines its "scope of required
uniqueness," and a 16-byte GUID is essentially globally unique so long as
it has no collisions within its context(s). (i.e. who cares if SHA1s
collide, so long as it's not in the same repo?)


-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to