News for hackers. Stuff that matters.
Re:The German Tank Problem by jjs on Tuesday June 23, 2009 @11:57AM (#670591)
Heh, I was just thinking about this problem recently; it played a (small) part in my decision to use random-ish strings as primary keys rather than autoincrementing ints. :)
Re:The German Tank Problem by narag on Tuesday June 23, 2009 @12:19PM (#670639)
Apparently it's also a good idea for tanks.
Re:The German Tank Problem by die_sekte on Tuesday June 23, 2009 @01:24PM (#670757)
If you store tanks in a SQL database, it is.
Re:The German Tank Problem by narag on Wednesday June 24, 2009 @11:02AM (#672166)
If your tank is downloadable, you sholud also provide the hash signature :-)
Re:The German Tank Problem by xal on Wednesday June 24, 2009 @12:54AM (#671593)
hah, you better not be doing this on mysql/innodb
Re:The German Tank Problem by jjs on Wednesday June 24, 2009 @03:06AM (#671736)
I am for the moment; if postgres is really that much better in this regard, please let me know why you think so.

Incidentally, I'm using VARBINARY, not VARCHAR for the keys.

Re:The German Tank Problem by xal on Wednesday June 24, 2009 @05:57PM (#672797)
Mysql/innodb lays out the data on disk in sort order of the primary key. If you use GUIDs as primary key it will have to re-write the entire disk layout every time you insert. Just use auto inc IDs, they are by far the best option as long as you use a suffix of 10 or so to avoid ID collisions when you ever have several masters to write to ( which you will never have ).
Re:The German Tank Problem by jjs on Thursday June 25, 2009 @01:57AM (#673228)
There are other reasons I want to use strings-as-keys. Are you familiar with how, say, postgres handles this sort of thing, and is it any better in this regard?
Re:The German Tank Problem by jjs on Thursday June 25, 2009 @06:53AM (#673440)
It occurs to me that I could still use integer primary keys internally and have indexed strings as external lookup keys. I want the same key to be able to show (a) which user, (b) which database, and (c) which row, so I can verify ownership and route directly to the particular sub-db without having to do several lookups first.
Re:The German Tank Problem by Tichy on Wednesday June 24, 2009 @03:01AM (#671729)
Please elaborate?