3 ms·
Isn't auto generating UUIDs "fast enough" in most situations that its negligible? In particular databases (where UUIDs taking space was a big concern) they hav
by no_wizard 3y ago
Isn't auto generating UUIDs "fast enough" in most situations that its negligible?
In particular databases (where UUIDs taking space was a big concern) they have largely switched to a packed binary format that makes the size of UUIDs over time a non issue for all practical purposes.
- hot_gril 3y agoUUIDs are packed in DBs. But they tend to get misused as PKs. In common relational DBs, your PK for every table should probably be bigserial.
- siva7 3y agoNo, that shouldn’t be the criteria (common relational db) when deciding to use bigserial v UUID but the overall architecture and requirements of your system.
- hot_gril 3y agoWhatever your overall requirements are, if you've already decided on a relational DB to solve them, you probably want bigserial PKs in said DB. The DBMS is optimized for that (as I've noticed in Postgres), and you don't gain anything by using UUIDs instead there. UUID in a secondary col or elsewhere in your system, that's fine. If you have to look up by UUID from outside and have no foreign keys, UUID PKs can be faster. But that's the classic use case for a non-relational DB.