-
Notifications
You must be signed in to change notification settings - Fork 674
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
Should things and channels entity ID be UUIDv4? #403
Comments
@chombium @nmarcetic @anovakovic01 @dusanb94 @srados @blokovi what are your comments on this? |
If you need globally unique IDs then a UUID is just fine. PostgreSQL and other systems have a fine way of indexing them too, so that's not really a concern as long as your key is a type My approach was aimed at Finally - the article you referenced has a number of flame-waving weirdnesses. A UUIDs are fine primary keys, particularly when they need to be truly, globally unique. Otherwise yeah - they're overkill. |
@robconery UUIDv4 I mentioned are of type TBH, for Mainflux is is not likely to happen, Postges here works just fine and it's a good use-case. We thought that metadata (identities) here needed strong consistency, although it might turn out in the future that people are ready to trade this consistency for easier scalability and flexibility of easily changing data models without complicated migrations. The only thing that we did try and had very good results is replacing Postgres with CockroachDB v2, which is 1:1 replacement - we did not change one line of code. Cockroach is really easy to scale, and in our Kubernetes deployment it was behaving quite nice. BUt it generated different serial IDs than Postgres (non-icremental). As a note - we use Generating UUIDv4 with aforementioned library might in some rare cases lead to inconsistency - i.e. conflicts. This is why Twitter created project Snowflake:
which was later archived. Another interesting article: https://preparingforcodinginterview.wordpress.com/2017/03/21/unique-id-generation-in-distributed-systems/ This project looks very interesting: https://github.com/segmentio/ksuid There is also this: https://github.com/ericelliott/cuid @robconery from what I see both |
This change will be done by resolving #475. |
Currently we use Postgres serial sequece number. This ensures consistence (no-conflicting UUID) but is not generic enough - i.e. switching to another DB like CockroachDB is changing the format of ID field.
Should we introduce UUIDv4 here, knowing the drawbacks: https://rclayton.silvrback.com/do-you-really-need-a-uuid-guid, or find some other solution in which we can keep ID derived broth from Postgres and Cockroach.
Also interesting article: https://rob.conery.io/2014/05/28/a-better-id-generator-for-postgresql/
The text was updated successfully, but these errors were encountered: