-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discussion] Auto Incrementing IDs or UUIDs or Both? #205
Comments
Using UUIDs as the primary key to an object has some pros and cons... Pros
Cons
|
Using Auto-incrementing IDs as the primary key for objects. Pros
Cons
|
@dmlb2000 UUIDs are encoded with 128 bits. The collision rate for UUIDs is very, very low (c.f., https://en.wikipedia.org/wiki/Universally_unique_identifier#Collisions). It may be feasible for API clients to generate their own UUIDs. |
The outstanding question I'd like to see addressed is there any reason why a hybrid approach would be used? Is the question an exclusive or? |
@dmlb2000 Distributed identity across federated systems (such as databases) is a longstanding technical challenge. The low collision rate of UUIDs makes some aspects less painful. For me, this is an xor. Auto-incremented, fixed-width integers are great... until you run out of them. |
The process to transition from Auto-incrementing IDs to UUIDs would be to add the column. Hopefully, PeeWee will help by generating UUIDs otherwise we'll need to loop over all rows creating them. Lastly, drop the ID field. For systems that put data into these new tables they were expecting numeric IDs but now are given UUIDs they may not have in their existing systems. We need to have a discussion about what's considered unique about each object and make sure that's documented. |
With recent releases of metadata the My initial thought is to apply this to everything but NxM tables, This is pragmatic since converting those to are a heavier lift, the Ingest would need to be refactored for changing Transactions over. Converting and worse reformatting would be required to convert |
I'm wondering if we need to drop the ID field now or just keep it around but make it nullable. At looking deeper into other CMS systems they like to have both. The UUID is the primary key, required and auto-generated. The ID field is a number that is allowed to be NULL, not the primary key, and is unique. This maybe more general approach and would be suitable for EMSL usage (hopefully). |
I'd like to document discussion on auto-incrementing IDs vs. UUIDs or some hybrid approach to identifying unique instances of objects in a database.
Please think about pros and cons of each approach or suggestions made.
Depending on the outcome of this it will affect #200 and #201. If we drop auto incrementing IDs then one closes and the other gets fixed a specific way.
The text was updated successfully, but these errors were encountered: