-
Notifications
You must be signed in to change notification settings - Fork 160
May be a good idea to use snowflake as the primary key? #12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hello, @dongfengweixiao what advantage do you expect of using snakeflake vs uuid? |
Hello @jonra1993 , the pros and cons can be read here: https://medium.com/geekculture/the-wild-world-of-unique-identifiers-uuid-ulid-etc-17cfb2a38fce. Compared with the uuid v1 and the uuid v4, the v4 version has a very low probability of duplication. |
Hello @dongfengweixiao thanks for the link I am going to check it |
If this is done there is no need for the created_at column in any tables it is used, as it would be known by decoding the snowflake |
Bad idea. All field serves the business logic. The id field should only be used to mark uniqueness. Do not use the id field for additional purposes. |
@dongfengweixiao may have a point, use your best judgment |
Hello guys, after testing and looking to make the project simple to use and maintain, I have used UUID7 as the database's primary key and added some information about it on the README file including references to alternatives of IDs. |
GREAT! |
RT
https://github.com/agnirudrasil/avault/blob/c6ca7037a5a99d97fcf43eb6b9ef935439171c02/backend/app/api/utils/snowflake.py
The text was updated successfully, but these errors were encountered: