Hacker News new | past | comments | ask | show | jobs | submit login

You’ve maybe not had a use case for sortable uuids, so I can provide one:

Columnar databases like Clickhouse don’t have the kind of indices that you’d be used to if you only used OLTP databases like eg Postgres. Instead, you essentially get one index per table, which is the order that things are laid out on disk*

The problem is that you might want 2 access patterns, one for aggregating data within a time range, and another for looking up / joining data by its ID. So which do you use as the index? Timestamp or ID? If the ID is a uuidv4 and you index by ID, your time range queries need to scan the entire table, and vice versa. If the ID is time-sortable (eg uuidv7), this stops being a problem, and you don’t need some kind of workaround*

* it’s a little more complicated than this but that not in a way that affects the example

* eg a projection of your data with a different index




I understand your usecase. I just think it's a horrible hack.


HEH... yeah. Why does software engineering always go out the window when there appear to be a couple of unused bits?


This is exactly why I'm using ULID with DynamoDB.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: