As I told you, this can be done this or other way.
But:
> 3. take the first 4 or 8 bytes of the hash and use it as a
> key for the
> new record.
And manage collisions manually.
> as commit identifiers in Git, for example.
>
This is great example. When I work with SVN I can remember quite
easily, or send by mail:
The fix is done in changeset 14234 -- you can remember this and you can
See what happens before or after it. In GIT you can send
The fix is done in changeset af36bc35fd35bcdf2
Try to remember it? Try to write it down.
What is easier:
svn.boost.org/bugs/ticket/2340
or
svn.boost.org/bugs/ticket/23589062350234
I think this is clear.
> For an example of something that gives similar results, see
> the form of
> YouTube video links. The stuff that is appended
> after the domain name
> does not look like a last_insert_id to me, it is almost
> certainly a hash
> of some sort.
I agree, that in case of YouTube it is good if not the only possible
solution, however, for vast majority of applications running sequence
or auto increment is much better and appropriate solution.
> The advantage of this solution is that such IDs are generated in a
> widely scattered way (seemingly randomized within the target range),
This is quite not good. And I explain why. Auto-incremented ids have
locality according to time line. For example, vast majority of access
to tickets or to some forum would be localized in some period of time
(latest) so they would be in same place at disc, so locality would
be an advantage.
In summary:
Not every generic best practice is best to apply everywhere, if I write
some simple program that uses small database like Sqlite3 as data storage
and requires some running ids. Sequences or auto-increment are perfect
solutions for such purposes.
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users