logoalt Hacker News

vintermannyesterday at 12:48 PM5 repliesview on HN

I disagree that performance should be a reason to choose running numbers over guids until you absolutely have to.

I think IDs should not carry information. Yes, that also means I think UUIDv7 was wrong to squeeze a creation date into their ID.

Isn't that clear enough?


Replies

mcnyyesterday at 1:22 PM

That's the creation date of that guid though. It doesn't say anything about the entity in question. For example, you might be born in 1987 and yet only get a social security number in 2007 for whatever reason.

So, the fact that there is a date in the uuidv7 does not extend any meaning or significance to the record outside of the database. To infer such a relationship where none exists is the error.

show 3 replies
hyperpapeyesterday at 1:59 PM

Those are two unrelated points and the connection between them was unclear in the original post.

hxtkyesterday at 6:37 PM

When I think "premature optimization," I think of things like making a tradeoff in favor of performance without justification. It could be a sacrifice of readability by writing uglier but more optimized code that's difficult to understand, or spending time researching the optimal write pattern for a database that I could spend developing other things.

I don't think I should ignore what I already know and intentionally pessimize the first draft in the name of avoiding premature optimization.

barrkelyesterday at 1:27 PM

UUID v7 doesn't squeeze creation date in. If you treat it as anything other than a random sequence in your applications, you're just wrong.

show 1 reply
anamexisyesterday at 1:47 PM

For what it’s worth, it was also completely unclear to me how you were responding to the article itself. It does not discuss natural keys at all.