Loading devShakib…
Bulk-generate UUID v4/v7, ULID and NanoID identifiers and copy them all at once.
UUID version 4 is 122 random bits and nothing else, which makes it collision-proof for any practical purpose and completely unordered. That last part has a cost people meet at scale: random primary keys scatter writes across a B-tree index, so every insert lands somewhere new and the database cannot keep the hot pages in memory.
Version 7 was standardised to fix precisely that. It puts a millisecond timestamp in the leading bits and randomness after, so identifiers generated close together sort close together and inserts stay near the end of the index. You also get a rough creation time out of the identifier for free.
ULID solves the same problem with different trade-offs — 26 characters of Crockford base32, which is case-insensitive and skips the letters most easily confused with digits, so it survives being read aloud or typed off a screen. NanoID is the choice when the identifier goes in a URL and length is what you are optimising.