6 ms·
> They are awful as keys – being strings, comparisons are dramatically slower than with integers. And even if your database has a UUID type, it’s still worse be
by gnu8 3y ago
> They are awful as keys – being strings, comparisons are dramatically slower than with integers. And even if your database has a UUID type, it’s still worse because the identifier doesn’t fit into a machine word.
I’m just a bit confused, a UUID is made up of hexadecimal digits, so why would it be stored as a string? It’s also 128 bits long, so it should fit into two words, excluding whatever overhead the DBMS puts on the data type, which is really their problem to worry about.
- MatthiasPortzel 3y agoThis is a non-uncommon mistake. People, such as the author, seem to think that the UUID is a hex string containing dashes, since that is the format that they most frequently see them represented. You are correct that a UUID is a 128 bit identifier, and so, fits in 128 bits.
- wizofaus 3y agoApparently Stripe stores its keys as strings, though not the usual UUID string representation.
- yamtaddle 3y agoI'm like 90% sure Stripe started on MongoDB (may still be using Mongo?). That might have something to do with it.
- tatersolid 3y agoA company which handles money as its primary business is using MongoDB? Hopefully the actual dollars are always handled in a “realSQL” DB with proper transaction isolation.
- yamtaddle 3y agoI recalled that specifically because I remember having the same reaction when I found it out (I think? I have a distinct memory of learning this) back in 2012 or something.