Generating valid identifiers
Laszlo Nagy
gandalf at shopzeus.com
Fri Jul 27 03:28:56 EDT 2012
> As a side note, the odds of having at least one hash collision among
> multiple tables are known as the birthday problem. At 4 hex digits
> there are 65536 possible digests, and it turns out that at 302 tables
> there is a >50% chance that at least one pair of those names have the
> same 4-digit digest. That doesn't mean you should be concerned if you
> have 302 tables in your Django Oracle database, though, because those
> colliding tables also have to match completely in the first 26
> characters of their generated names, which is not that common. If a
> collision ever did occur, the resolution would be simple: manually set
> the name of one of the offending tables in the model definition.
>
> With 16 ** 10 possible digests, the probability of collision hits 50%
> at 1234605 tables.
Thank you for the precise explanation. :-) Well, if Django and Oracle
uses this, then it can't be a very bad idea. :-)
More information about the Python-list
mailing list