3 ms·
Getting a collision with this approach doesn’t matter — the whole point is to loop if you do get a collision. The only issue is getting a long string of sequent
by oconnore 5y ago
Getting a collision with this approach doesn’t matter — the whole point is to loop if you do get a collision. The only issue is getting a long string of sequential collisions, which is highly unlikely.
- kstrauser 5y agoBut now you’ve tried code complexity for a few bytes if storage. That’s just not worth it.
- sa46 5y ago8 extra bytes per row and per foreign key reference relative to an int64 can add up quickly especially if the row is small. I agree it’s not typically the right trade off but it’s not as absolute as you claim.
- throwawayboise 5y agoThis is why we need 2TB drives now, when we used to get by with 2GB.
- rswail 5y agoBack in my day we measured things in Ks, not Ms or Gs or Ts. Get off my lawn... But seriously, UUIDs work, they don't need application code to avoid collisions. If you want something a bit more compact/shardable, use ULIDs.