Hacker News new | past | comments | ask | show | jobs | submit login

I've been doing something that includes a type character as the first character - followed by 11 random base58 digits. This allows > 2^64 possible ids and a type in ~12 bytes. I occasionally wish they were ordered, but most of my tables usually have a 'created_at' field anyway should ordering matter.

I feel like uuid / ulid are just overkill for most situations - and they're long and kinda ugly imo.




Isn't that basically a type 4 UUID that you truncated the last 4 bytes from?


The encoding is completely different? And given that encoding I don't go to any great means to store them as a special type in the db - just text. uuid being hexidecimal, databases often want to store them as binary since that's half the bytes...


You could encode UUIDs as base58, though I'm with you that that doesn't seem to make a lot of sense.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: