title: How to Prevent MySQL UUID V1 Collision
body: <p>Our API is designed to generate UUIDs in MySQL for all records.</p>
  
  <p>However, 99% of the records being generated in all tables share the same last 3 blocks of the UUID. I'm assuming this is because MySQL uses v1 of UUID which is based on Mac address which doesn't change on the same server. It doesn't seem like enough entropy to have a high level of confidence in uniqueness.</p>
  
  <p>e.g. XXXXXXXX-XXXX-46fc-bb08-f9b12276ed01</p>
  
  <p>This is validated per Wikipedia:</p>
  
  <p>"given the speed of modern processors, successive invocations on the same machine of a naive implementation of a generator of version 1 UUIDs may produce the same UUID, violating the uniqueness property. (Non-naïve implementations can avoid this problem by, for example, remembering the most recently generated UUID, "pocketing" unused UUIDs, and using pocketed UUIDs in case a duplicate is about to be generated.)"</p>
  
  <p>It sounds like if enough API calls are made within a certain amount of time that collision would all be certain (just a matter of reaching transactional volume e.g. 1000 transactions a second? i.e. close to 1 transaction per millisecond). </p>
  
  <p>Assumption: UUID() is function of the MySQL binary which cannot be changed.</p>
  
  <p><strong>At what volume do I need to evaluate a change to prevent collisions and how would I make the wikipedia recommended change in MySQL to "pocket" UUIDs?</strong></p>