On 22 Apr 2014, at 4:55pm, Dominique Devienne <ddevie...@gmail.com> wrote:

> Simply because of the extra space needed to store it. 36 bytes vs 16
> bytes. That's 20 wasted bytes for the PK, and everytime that PK is
> references in other tables' FKs too. Times millions of rows, it adds
> up, for nothing. The GUID is no less "genuine" as you put it, just
> because it's stored as a 16-bytes blob rather than the canonical
> 36-char text preferred by humans.

And if you use GUIDs a lot, make two functions for SQLite which convert to and 
from text form.  Loading external functions is something SQLite really is 
excellent at.


On 22 Apr 2014, at 5:57pm, Stephan Beal <sgb...@googlemail.com> wrote:

> 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?)

You might be interested in UUIDs, which define the scope and provide methods 
for presenting hashed, sequential and random GUIDs within that scope:

<http://en.wikipedia.org/wiki/Universally_unique_identifier>

Libraries are available for many languages to generate UUIDs under many of 
these schemes.


On 22 Apr 2014, at 6:57pm, RSmith <rsm...@rsweb.co.za> wrote:

> Just to add  - I cannot imagine why you would have dashes to start with

Take, for example, this GUID:

550e8400-e29b-41d4-a716-44de5544ac00

A program (or a TABLE) frequently handles many GUIDs which differ only in one 
of the fields.  For instance a program may have to represent a GUID externally 
(on the screen and output files) with the complete GUID, but it could store 
items internally (perhaps in a database) using only the last 12 hex digits, or 
as an integer up to 2^48.  Since it know that all people GUIDs start

550e8400-e29b-41d4-a716-

whereas all vehicles GUIDs start

550e8404-31e6-41d4-a716-

there is no need to store them all in a table where the column tells you 
definitively whether you're talking about a person or a vehicle.

When you're doing a lot of this sort of thing having the hyphens visible speeds 
up human time in figuring out what they're looking at.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to