I want to generate "unguessable" IDs, rather than /record/1, /record/2, /record/3 etc.
YouTube's style of using base 64 allows for 16.7 million IDs to be stored in just 4 characters (64 * 64 * 64 * 64). This would be more than enough for my needs.
My only pondering is whether I should be storing them as ints in the database and converting them every time a request comes in (or when I need to generate a url), or storing them as the string that the user will see. And why?
A couple of follow-up questions:
1) rather than generating random integers and converting them to the base64 string, should I use auto-increment numbers with a salt to randomise the alphabet, so I can get apparently "random" identifiers from IDs of 1 2 3 4 5 6 7 etc. And why?
2) for table relationships should I use whatever I've generated as my PK/FK, or should that be a separate column and just a simple auto-increment int, for some reason?