title: PHP - Is uniqid("") a good practical solution to generate a unique and sequential key server side?
body: <p>All,</p>
  
  <p>I want to generate <strong>server side</strong> a user id during registration.  This id should be sequential to allow for clustered indexing.  It also needs to be unique, obviously.</p>
  
  <p>To what extent can I use <code>uniqid("")</code> for this?  I am not building Google, and I assume that the risk of 2 users registering at the same microsecond is close to nill - but I have no practical experience on which to base myself.  SQL will reject duplicate id's, and I can have a loop in my php code that will keep on sending new registration entries in case of collisions / data entry failures, but that's only a good approach if collisions are rare.</p>
  
  <p>Alternatively, I could add a random postcript with <code>uniqid("",TRUE)</code>, but then if 2 users register during the same microsecond, the keys can not be sequential anymore.</p>
  
  <p>What is the best, practical approach to my conundrum?  Am I overthinking this?</p>
  
  <p>Thanks,</p>
  
  <p>JDelage</p>