Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: An improved technique for database primary keys

by fullermd (Priest)
on Nov 05, 2010 at 05:32 UTC ( #869625=note: print w/replies, xml ) Need Help??

in reply to An alternate technique for database primary keys

The choice of “8 characters’ is arbitrary, but it should simply be long enough that a “collision” is impossible.
I woke up screaming when I read that. And I wasn't even asleep.
  • Comment on Re: An improved technique for database primary keys

Replies are listed 'Best First'.
Re^2: An improved technique for database primary keys
by sundialsvc4 (Abbot) on Nov 05, 2010 at 13:24 UTC

    Sleep well.   It is a calculated-risk, and of course the index in question must be UNIQUE so that colliding values, if they were somehow generated, would not be stored.   You could, of course, go so far as to use Microsoft’s UUIDs (GUIDs).

    The notion is simply that, if the string is random and sufficiently long, key collisions in-practice “ain’t never actually gonna happen.”   Your mileage may vary.   Choose appropriately.   If, in whatever context you may be dealing with, this admonition isn’t sound, then don’t follow it.   Peace.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://869625]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-06-24 11:59 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.