frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Effects of Vegetable and Fruit Juicing on Gut and Oral Microbiome Composition

https://www.mdpi.com/2072-6643/17/3/458
1•manidoraisamy•50s ago•0 comments

Nvidia details new software that enables location tracking for AI GPUs

https://www.tomshardware.com/pc-components/gpus/nvidia-details-new-software-that-enables-location...
1•01-_-•2m ago•0 comments

Bondi Beach shooting: How the tragedy unfolded

https://www.reuters.com/graphics/AUSTRALIA-CRIME/byprbxmgxpe/
1•giuliomagnifico•3m ago•0 comments

Show HN: Webhook Tester – RequestBin-style webhooks inbox built on Cloudflare

https://eventdock.app/tools/webhook-tester/
1•kidsil•3m ago•0 comments

War and Peace is a honking doorstopper

https://twitter.com/patrickc/status/2000526043250094483
1•tapanjk•4m ago•0 comments

Show HN: I Built an UI Library for Non CSS Developers – OgBlocks

https://ogblocks.dev/
1•ogkaran•6m ago•0 comments

Why digital designers should appreciate the luxury of the medium

https://mikajovicic.com/writing/digital-medium-can-be-infinitely-improved/
1•violinar•8m ago•0 comments

Jolla – The Other Half Returns – Community Innovation Program

https://forum.sailfishos.org/t/the-other-half-returns-community-innovation-program/26011
1•embedding-shape•9m ago•0 comments

Dell and Lenovo may limit mid-range laptops to 8GB RAM because of memory prices

https://www.notebookcheck.net/Dell-and-Lenovo-may-limit-mid-range-laptops-to-8GB-DDR5-RAM-in-resp...
2•akyuu•20m ago•2 comments

The "Hardware Friction Map": Why technically superior architectures fail to ship

https://lambpetros.substack.com/p/the-hardware-friction-map
2•speiroxaiti•23m ago•1 comments

GCC Developers Considering Whether to Accept AI/LLM-Generated Patches

https://www.phoronix.com/news/GCC-To-Consider-LLM-Patches
2•turrini•24m ago•0 comments

Why Americans Hate the Media (1996)

https://www.theatlantic.com/magazine/archive/1996/02/why-americans-hate-the-media/305060/
2•bell-cot•25m ago•0 comments

Built a new version of HN/Reddit

1•upvotenow•25m ago•0 comments

2025 Word of the Year: Slop

https://www.merriam-webster.com/wordplay/word-of-the-year
1•djoldman•27m ago•0 comments

Show HN: NeuroIndex – Hybrid AI memory with vectors and semantic graphs

https://github.com/Umeshkumar667/neuroindex
1•umesh667•28m ago•0 comments

Police investigate deaths of filmmaker Rob Reiner and wife as apparent homicide

https://www.reuters.com/business/media-telecom/two-people-found-dead-la-home-actor-director-rob-r...
1•pseudolus•29m ago•0 comments

SMART OKRs: the best highly-debatable way I know to align teams in large orgs

https://github.com/joelparkerhenderson/smart-okrs
1•jph•30m ago•0 comments

Sekaiju is a free, open-source MIDI sequencer / editor for Windows

https://openmidiproject.opal.ne.jp/Sekaiju_en.html
2•unleaded•33m ago•0 comments

Show HN: Building an OS for self-improving ecommerce stores

https://shopos.ai/
1•RendrrHaider•34m ago•1 comments

Show HN: AppScreenshots – AI-Powered App Store Screenshot Generator

https://www.appscreenshots.net
1•horace168•41m ago•0 comments

Notes from Neal Gabler's Walt Disney

https://notes.eatonphil.com/2023-02-18-neal-gabler-walt-disney-notes.html
1•ibobev•43m ago•0 comments

Writing a mockable Filesystem trait in Rust without RefCell

https://pyk.sh/blog/2025-12-15-writing-mockable-fs-in-rust-without-refcell
1•peeyek•43m ago•0 comments

Copywriters reveal how AI has decimated their industry

https://www.bloodinthemachine.com/p/i-was-forced-to-use-ai-until-the
3•thm•43m ago•0 comments

Generating and using Let's Encrypt wildcard certificates with cert‑manager

https://chuniversiteit.nl/operations/wildcard-certificates-in-kubernetes
1•ibobev•43m ago•0 comments

When LICM Fails Us

https://xania.org/202512/14-licm-when-it-doesnt
1•ibobev•43m ago•0 comments

AI Analyzes Language as Well as a Human Expert

https://www.wired.com/story/in-a-first-ai-models-analyze-language-as-well-as-a-human-expert/
1•Brajeshwar•45m ago•0 comments

Olmo 3 and the Open LLM Renaissance

https://cameronrwolfe.substack.com/p/olmo-3
1•Philpax•52m ago•0 comments

Amiga Old Blue Workbench

https://aminet.net/package/util/wb/OBWorkbench
1•doener•54m ago•0 comments

Vibe Coding hit a wall: How I fixed $0.30/error OOMs and cut AI costs by 70%

https://blog.videowatermarkremove.com/vibe-coding-hit-a-wall-how-i-fixed-030error-ooms-and-cut-ai...
1•ilmj8426•1h ago•0 comments

Ask HN: What is Safe Superintelligence Inc building?

https://ssi.inc
2•javantanna•1h ago•2 comments
Open in hackernews

Avoid UUIDv4 Primary Keys

https://andyatkinson.com/avoid-uuid-version-4-primary-keys
62•pil0u•1h ago

Comments

jwr•1h ago
"if you use PostgreSQL"

(in the scientific reporting world this would be the perennial "in mice")

hyperpape•50m ago
The thing is, none of us are mice, but many of us use Postgres.

It would be the equivalent of "if you're a middle-aged man" or "you're an American".

P.S. I think some of the considerations may be true for any system that uses B-Tree indexes, but several will be Postgres specific.

orthoxerox•48m ago
It's not just Postgres or even OLTP. For example, if you have an Iceberg table with SCD2 records, you need to regularly locate and update existing records. The more recent a record is, the more likely it is to be updated.

If you use UUIDv7, you can partition your table by the key prefix. Then the bulk of your data can be efficiently skipped when applying updates.

kijin•46m ago
The space requirement and index fragmentation issue is nearly the same no matter what kind of relational database you use. Math is math.

Just the other day I delivered significant performance gains to a client by converting ~150 million UUIDv4 PKs to good old BIGINT. They were using a fairly recent version of MariaDB.

zelphirkalt•16m ago
If they can live with making keys only in one place, then sure, this can work. If however they need something that is very highly likely unique, across machines, without the need to sync, then using a big integer is no good.

if they can live with MariaDB, OK, but I wouldn't choose that in the first place these days. Likely Postgres will also perform better in most scenarios.

splix•7m ago
I think the author means all dbs that fit a single server. Because in distributed dbs you often want to spread the load evenly over multiple servers.
benterix•1h ago
The article sums up some valid arguments against UUIDv4 as PKs but the solution the author provides on how to obfuscate integers is probably not something I'd use in production. UUIDv7 still seems like a reasonable compromise for small-to-medium databases.
mort96•43m ago
I tend to avoid UUIDv7 and use UUIDv4 because I don't want to leak the creation times of everything.

Now this doesn't work if you actually have enough data that the randomness of the UUIDv4 keys is a practical database performance issue, but I think you really have to think long and hard about every single use of identifiers in your application before concluding that v7 is the solution. Maybe v7 works well for some things (e.g identifiers for resources where creation times are visible to all with access to the resource) but not others (such as users or orgs which are publicly visible but without publicly visible creation times).

cdmckay•37m ago
Out of curiosity, why is it an issue if you leak creation time?
robertlagrant•34m ago
Depends on the data. If you use a primary key in data about a person that shouldn't include their age (e.g. to remove age-based discrimination) then you are leaking an imperfect proxy to their age.
lwhi•25m ago
So the UUID could be used as an imperfect indicator of a records created time?
benterix•22m ago
UUIDv7 but not UUIDv4.
lwhi•18m ago
I suppose timing attacks become an issue too.
kreetx•26m ago
E.g, if your service users have timestamp as part of the key and this data is visible to other users, you would know when that account was created. This could be an issue.
mort96•24m ago
Well you're leaking user data. I'm sure you can imagine situations where "the defendant created an account on this site on this date" could come up. And the user could have created that account not knowing that the creation date is public, because it's not listed anywhere in the publicly viewable part of the profile other than the UUID in the URL.
bruce511•3m ago
The issue will be very context specific. In other words to (reasonably) answer the question, we'd have to judge each application individually.

For one example, say you were making voting-booth software. You really don't want a (hidden) timestamp attached to each vote (much less an incrementing id) because that would break voter confidentiality.

More generally, it's more a underlying principle of data management. Not leaking ancillary data is easier to justify than "sure we leak the date and time of the record creation, but we can't think of a reason why that matters."

Personally I think the biggest issue are "clever" programmers who treat the uuid as data and start displaying the date and time. This leads to complications ("that which is displayed, the customer wants to change"). It's only a matter of time before someone declares the date "wrong" and it must be "fixed". Not to mention time zone or daylight savings conversions.

Bombthecat•3m ago
Admins, early users, founders, CEOs etc etc would have althe lowest creation time...
nbadg•21m ago
I'm also not a huge fan of leaking server-side information; I suspect UUIDv7 could still be used in statistical analysis of the keyspace (in a similar fashion to the german tank problem for integer IDs). Also, leaking data about user activity times (from your other comment) is a *really* good point that I hadn't considered.

I've read people suggest using a UUIDv7 as the primary key and a UUIDv4 as a user-visible one as a remedy.

My first thought when reading the suggestion was, "well but you'll still need an index on the v4 IDs, so what does this actually get you?" But the answer is that it makes joins less expensive; you only require the index once, when constructing the query from the user-supplied data, and everything else operates with the better-for-performance v7 IDs.

To be clear, in a practical sense, this is a bit of a micro-optimization; as far as I understand it, this really only helps you by improving the data locality of temporally-related items. So, for example, if you had an "order items" table, containing rows of a bunch of items in an order, it would speed up retrieval times because you wouldn't need to do as many index traversals to access all of the items in a particular order. But on, say, a users table (where you're unlikely to be querying for two different users who happen to have been created at approximately the same time), it's not going to help you much. Of course the exact same critique is applicable to integer IDs in those situations.

Although, come to think of it, another advantage of a user-visible v4 with v7 Pk is that you could use a different index type on the v4 ID. Specifically, I would think that a hash index for the user-visible v4 might be a halfway-decent way to go.

I'm still not sure either way if I like the idea, but it's certainly not the craziest thing I've ever heard.

xandrius•1h ago
To summarise the article: in PG, prefer using UUIDv7 over UUIDv4 as they have slightly better performance.

If you're using latest version of PG, there is a plugin for it.

That's it.

sbuttgereit•29m ago
You might have missed the big H2 section in the article:

"Recommendation: Stick with sequences, integers, and big integers"

After that then, yes, UUIDv7 over UUIDv4.

This article is a little older. PostgreSQL didn't have native support so, yeah, you needed an extension. Today, PostgreSQL 18 is released with UUIDv7 support... so the extension isn't necessary, though the extension does make the claim:

"[!NOTE] As of Postgres 18, there is a built in uuidv7() function, however it does not include all of the functionality below."

What those features are and if this extension adds more cruft in PostgreSQL 18 than value, I can't tell. But I expect that the vast majority of users just won't need it any more.

tmountain•18m ago
Sticking with sequences and other integer types will cause problems if you need to shard later.
zwnow•9m ago
Especially in larger systems, how does one solve the issue of reaching the max value of an integer in their database? Sure for unsigned bigint thats hard to achieve but regular ints? Apps quickly outgrow that.
dotancohen•56m ago
From the fine article:

  > Random values don’t have natural sorting like integers or lexicographic (dictionary) sorting like character strings. UUID v4s do have "byte ordering," but this has no useful meaning for how they’re accessed.
Might the author mean that random values are not sequential, so ordering them is inefficient? Of course random values can be ordered - and ordering by what he calls "byte ordering" is exactly how all integer ordering is done. And naive string ordering too, like we would do in the days before Unicode.
kreetx•46m ago
Using an UUIDv4 as primary key is a trade-off: you use it when you need to generate unique keys in a distributed manner. Yes, these are not datetime ordered and yes, they take 128 bits of space. If you can't live with this, then sure, you need to consider alternatives. I wonder if "Avoid UUIDv4 Primary Keys" is a rule of thumb though.
dotancohen•39m ago
If one needs timestamp ordering, then UUIDv7 is a good alternative.

But the author does not say timestamp ordering, he says ordering. I think he actually means and believes that there is some problem ordering UUIDv4.

kreetx•29m ago
Yup. There are alternatives depending on what the situation is: with non-distributed, you could just use a sufficiently sized int (which can be rather small when the table is for e.g humans). You could add a separate timestamp column if that is important.

But if you need UUID-based lookup, then you might as well have it as a primary key, as that will save you an extra index on the actual primary key. If you also need a date and the remaining bits in UUIDv7 suffice for randomness, then that is a good option too (though this does essentially amount to having a composite column made up of datetime and randomness).

dagss•14m ago
The point is how closely located data you access often is. If data is roughly sorted by creation time then data you access close to one another in time is stored close to one another on disk. And typically access to data is correlated with creation time. Not for all tables but for many.

Accessing data in totally random locations can be a performance issue.

Depends on lots of things ofc but this is the concern when people talk about UUID for primary keys being an issue.

torginus•5m ago
To be polite, I don't think this article rests on sound technical foundations.
waynenilsen•53m ago
What kills me is I can’t double click the thing to select it.
mcny•52m ago
Postgresql 18 released in September and has uuidv7

https://www.postgresql.org/docs/current/functions-uuid.html

dimitrisnl•41m ago
Noob question, but why no use ints for PK, and UUIDs for a public_id field?
edding4500•33m ago
*edit: sorry, misread that. My answer is not valid to your question.

original answer: because if you dont come up with these ints randomly they are sequential which can cause many unwanted situations where people can guess valid IDs and deduce things from that data. See https://en.wikipedia.org/wiki/German_tank_problem

javawizard•30m ago
Hence the presumed implication behind the public_id field in GP's comment: anywhere identifiers are exposed, you use the public_id field, thereby preventing ID guessing while still retaining the benefits of ordered IDs where internal lookups are concerned.

Edit: just saw your edit, sounds like we're on the same page!

javaunsafe2019•30m ago
So We make things hard in the backend because of leaky abstractions? Doesn't make sense imo.
jcims•16m ago
Decades of security vulnerabilities and compromises because of sequential/guessable PKs is (only!) part of the reason we're here. Miss an authorization check anywhere in the application and you're spoon-feeding entire tables to anyone with the inclination to ask for it.
grim_io•28m ago
The article mentions microservices, which can increase the likelihood of collisions in sequential incremental keys.

One more reason to stay away from microservices, if possible.

bardsore•24m ago
Always try to avoid having two services using the same DB. Only way I'd ever consider sharing a DB is if only one service will ever modify it and all others only read.
grim_io•14m ago
Good luck enforcing that :)
mrkeen•5m ago
The 'collision' is two service classes both trying to use one db.

If you separate them (i.e. microservices) the they no longer try to use one db.

alerighi•25m ago
If you put an index on the UUID field (because you have an API where you can retrieve objects with UUID) you have kind of the same problem, at least in Postgres where a primary key index or a secondary index are more or less the same (to the point is perfectly valid in pgsql to not have any primary key defined for the table, because storage on disk is done trough an internal ID and the indexes, being primary or not, just reference to the rowId in memory). Plus the waste of space of having 2 indexes for the same table.

Of course this is not always the case that is bad, for example if you have a lot of relations you can have only one table where you have the UUID field (and thus expensive index), and then the relations could use the more efficient int key for relations (for example you have an user entity with both int and uuid keys, and user attribute references the user with the int key, of course at the expense of a join if you need to retrieve one user attribute when retrieving the user is not needed).

Lucasoato•41m ago
Hi, a question for you folks. What if I don’t like to embed timestamp in uuid as v7 do? This could expose to timing attacks in specific scenarios.

Also is it necessary to show uuid at all to customers of an API? Or could it be a valid pattern to hide all the querying complexity behind named identifiers, even if it could cost a bit in terms of joining and indexing?

The context is the classic B2B SaaS, but feel free to share your experiences even if it comes from other scenarios!

lwhi•20m ago
Wouldn't you need to expose UUID if you want to make use of optimistic locking?
Lucasoato•9m ago
I feel that this is among the good reasons to keep exposing UUID in the API.
scary-size•40m ago
This reminds me about this old gist for generating Firebase-like "push IDs" [1]. Those have some nicer properties.

[1] https://gist.github.com/mikelehen/3596a30bd69384624c11

socketcluster•39m ago
My advice is: Avoid Blanket Statements About Any Technology.

I'm tired of midwit arguments like "Tech X is N% faster than tech Y at performing operation Z. Since your system (sometimes) performs operation Z, it implies that Tech X is the only logical choice in all situations!"

It's an infuriatingly silly argument because operation Z may only represent about 10% of the total CPU usage of the whole system (averaged out)... So what is promoted as a 50% gain may in fact be a 5% gain when you consider it in the grand scheme of things... Negligible. If everyone was looking at this performance 'advantage' rationally; nobody would think it's worth sacrificing important security or operational properties.

I don't know what happened to our industry; we're supposed to be intelligent people but I see developers falling for these obvious deceptive arguments over and over.

I remember back in my day, one of the senior engineers was discussing upgrading a python system and stated openly that the new version of the engine was something like 40% slower than the old version but he didn't even have to explain himself why upgrading was still a good decision; everybody in the company knew he was only talking about the code execution speed and everybody knew that this was a small fraction of the total. Everyone knew the database queries took most of the time (partly because they were not fully optimized).

Not saying UUIDv7 was a bad choice for Postgres. I'm sure it's fine for a lot of situations but you don't have to start a cult preaching the gospel of The One True UUID to justify your favorite project's decisions.

I do find it kind of sly though how the community decided to make this UUIDv7 instead of creating a new standard for it.

The whole point of UUID was to leverage the properties of randomness to generate unique IDs without requiring coordination. UUIDv7 seems to take things in a philosophically different path. People chose UUID for scalability and simplicity (both of which you get as a result of doing away with the coordination overhead), not for raw performance...

And no mention is made about the complex logic which has to take place behind the scenes to generate UUIDv7 IDs... People take it for granted that all computers have a clock which can produce accurate timestamps where all computers in the world are magically in-sync... UUIDv7 is not simple; it's very complicated. It has a lot of additional complexity and dependencies compared to UUIDv4.

That's the other thing which drives me nuts; people who don't understand the difference between performance and scalability. People foolishly equate scalability with parallelism or concurrency; whereas that's just one aspect of it; scalability is a much broader topic. It's the difference between a theoretical system which is fast given a certain artificially small input size and one which actually performs better as the input size grows.

kunley•34m ago
Wasn't choosing uuids as ids falling for the deceptive argument in the first place?
christophilus•9m ago
Not really, no. They’re very convenient for certain problems and work really well in general. I’ve never had a performance issue where the problem boiled down to my use of UUID.
dfox•35m ago
> Creating obfuscated values using integers

While that is often neat solution, do not do that by simply XORing the numbers with constant. Use a block cipher in ECB mode (If you want the ID to be short then something like NSA's Speck comes handy here as it can be instantiated with 32 or 48 bit block).

And do not even think about using RC4 for that (I've seen that multiple times), because that is completely equivalent to XORing with constant.

bux93•30m ago
Long article about why not to use UUIDv4 as Primary Keys, but.. Who is doing so? And why are they doing that? How would you solve their requirements? Just throwing out "you can use UUIDv7" doesn't help with, e.g., the size they take up.

Aren't people using (big)ints are primary keys, and using UUIDs as logical keys for import/export, solving portability across different machines?

Sayrus•27m ago
UUIDs are usually the go-to solution to enumeration problems. The space is large enough that an attacker cannot guess how many X you have (invoices, users, accounts, organizations, ...). When people replace the ints by UUIDv4, they keep them as primary keys.
cebert•25m ago
Using UUIDs as primary keys in non-relational databases like DynamoDB is valid and doesn’t raise the concerns mentioned in the article.