5 ms·
> Allowing a client to generate IDs can be a big help here (ie UUIDs) Trusting the client to generate a high-quality ID has a long history of being a bad idea
by jandrewrogers 1y ago
> Allowing a client to generate IDs can be a big help here (ie UUIDs)
Trusting the client to generate a high-quality ID has a long history of being a bad idea in practice. It requires the client to not be misconfigured, to not be hacked, to not be malicious, to not have hardware bugs, etc. A single server can generate hundreds of millions of IDs per second and provides a single point of monitoring and control.
- treyd 1y agoIn context I read that as database client, meaning the application server (which is a client to the database) providing the service to the user. Having that be able to generate IDs could be useful when needing to refer to the same entity, even if there is data that has to exist in some separate database for some reason.
- adamcharnock 1y agoThat is indeed what I had in mind, although I did leave it intentionally vague as everyone can asses what’s best for their own situation
- qazxcvbnm 1y agoI’ve once attempted to implement a solution where ids are generated by UUIDv5 from a certain owner and the relationship of the new item to the owner; that way, users cannot generate arbitrary ids but can still predict ahead of time their new ids to ease optimistic behaviour.
- deleted 1y ago[deleted]
- adrianmsmith 1y agoI think if you have (tenant, uuid) or (user, uuid) or whatever as your primary key, that's fine. If that tenant or user or whatever generates rubbish keys, that's their problem.