title: Using a long string as unique table id (or not)?
body: <p>I know this was discussed many times, I am hoping to get an advice for my specific case.</p>
  
  <p>I am working on a social networking site, that in theory should be able to have billions of photos recorded in mysql database.</p>
  
  <p>I was wondering if is a good idea to replace the unique BIGINT id of the records with a string id like 'oij43oj54oi52j43i'.</p>
  
  <p>The advantages would be that:</p>
  
  <ol>
  <li><p>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. </p></li>
  <li><p>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.</p></li>
  </ol>
  
  <p>The other tables like "photo_comments" could also use same string id when referring to the photo, e.g photo_comment_photo_id='oij43oj54oi52j43i';</p>
  
  <p>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 ?</p>
  
  <p>Thank you.</p>
  
  <p>Edit: ensuring the string is unique can be done by appending the user id to the string, and maybe use php <a href="http://php.net/manual/en/function.uniqid.php" rel="nofollow">uniqid()</a> that uses time-stamp microseconds.</p>