-
|
Currently, edgedb uses UUIDs based on time. This could be very convenient in not having to separately add a "time" field. However, this is currently undocumented behaviour which is not fun to be relying on. Any word on whether this feature is here to stay or not? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
|
No. This an implementation detail. We will consider changing it to UUID6 or UUID7 in the future. Also this implementation detail comes from using Postgres as a backend. Postgres's default btree indexes work better if object identifiers are somewhat ordered. If we add another backend that may not benefit from this feature of object ids (i.e. uses hash indexes for primary key) we can start using UUID4 or UUID8 when using that backend. |
Beta Was this translation helpful? Give feedback.
-
|
I recently discovered Cuid2. Eric writes a lot and it ends up in various discovery queues, but I have to admit I've read a lot of his stuff but never implemented any of it, mostly because there's an impression given through the writing style that I'll never be as smart as Eric. https://github.com/paralleldrive/cuid2#comparisons That said, I get it and I don't hate it. "Secure" or "insecure" is context dependent, so (shockingly) this opinion on Twitter lacks nuance. You can write your bank account PIN on a piece of paper and drop it on the street and there are very unlikely to be consequences. If you write your PIN on your bank card like my grandmother once did, that's a different risk profile. Databases are designed to strongly associate data, so they are always going to to be closer to Grandma's security implementation than... littering. So, to disagree slightly with @tailhook, I think this is more than an implementation detail. And in the spirit of not littering, what is the (most) correct UID algorithm for use in EdgeDB? |
Beta Was this translation helpful? Give feedback.
-
|
@tjltjl There's a potential concern with using time-based UUIDs noted here: https://github.com/paralleldrive/cuid2#note-on-k-sortablesequentialmonotonically-increasing-ids I have no direct experience with it, sorry to say, but it might be something to evaluate. There has to be a powerful space or performance constraint for you to want to drop a single datetime column, especially given that improvement that provides to the user, so this concern might be particularly relevant to you. |
Beta Was this translation helpful? Give feedback.

No. This an implementation detail. We will consider changing it to UUID6 or UUID7 in the future.
Also this implementation detail comes from using Postgres as a backend. Postgres's default btree indexes work better if object identifiers are somewhat ordered. If we add another backend that may not benefit from this feature of object ids (i.e. uses hash indexes for primary key) we can start using UUID4 or UUID8 when using that backend.