I know this was discussed many times, I am hoping to get an advice for my specific case.
I am working on a social networking site, that in theory should be able to have billions of photos recorded in mysql database.
I was wondering if is a good idea to replace the unique BIGINT id of the records with a string id like 'oij43oj54oi52j43i'.
The advantages would be that:
I could insert photo records into multiple databases spread on multiple servers unlike with the BIGINT id where you need to wait and get the next row number from mysql when inserting.
It would be less likely to allow users to randomly access images by entering integer numbers like /avatars/120.jpg if if it would be /avatars/oij43oj54oi52j43i.jpg. I know this second part can be done by URL rewrite too but would use some CPU/mem.
The other tables like "photo_comments" could also use same string id when referring to the photo, e.g photo_comment_photo_id='oij43oj54oi52j43i';
With these in mind, is it a bad idea to use the string ID? Especially for the first advantage that I mentioned, is that a valid point/advantage/practice ?
Thank you.
Edit: ensuring the string is unique can be done by appending the user id to the string, and maybe use php uniqid() that uses time-stamp microseconds.