Work in progress: 181,232 of 181,233 sites checked so far, more every week · updated 2 Nov 2026Missing a blog? Tell us

Top all-time · #12419

D

Dave Allie

Personal blog · blog.daveallie.comprogrammingdata

Dave Allie's personal blog at blog.daveallie.com covers programming and data. Since 2022, 6 different Hacker News readers have linked it 6 times, most often “ULIDs and Primary Keys (2022)”. The last post was in 2024, but the archive is still widely read.

Visit the blog
6mentions?
6HN people?
2022–2024first – last linked?
Links on Hacker News per year · peak 4 in 2024

Too few sampled comments (4) to say how often HN recommends it.?

Why HN links it

Posts on UUIDs and ULIDs as database primary keys, covering whether ULIDs can be stored as UUIDs, how they relate to UUIDv7, and insert and generation performance in Postgres.

Summarised by Claude from a sample of 4 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.

Most-linked posts?

  1. ULIDs and Primary Keys (2022)
    4 people · 4 mentions · first linked 2022-11-22
  2. /ulid-primary-keys/
    2 people · 2 mentions · first linked 2024-12-29

What Hacker News says?

  1. You can use ULID and store it as UUID since they are the same size. You can check this article for the details: https://blog.daveallie.com/ulid-primary-keys

    Comment linking /ulid-primary-keys

    on “Moving Away from UUIDs (2018)”
  2. Submitted ULIDs and Primary Keys (2022) as a story · 76 points

    HN discussion
  3. fnord123 · 2024-04-12Recommends
    Ok wow this blog post was really illuminating. Thanks for pushing back on my preconceived idea that UUIDv7 is the 'official' version of ULID https://blog.daveallie.com/ulid-primary-keys

    Comment linking /ulid-primary-keys

    on “The UX of UUIDs”
  4. Submitted ULIDs and Primary Keys as a story · 1 points

    HN discussion
  5. I don't think that's right. They show in the section titled "Generating" that the performance of calling the ULID function from SQL is only very slightly slower. It's the INSERT that performs worse. Generally, inserting sorted values (like sequential integers or in this case, ULIDs) into a B-tree index is much faster than inserting random values. This is because inserted values go into the same, highly packed B-tree…

    Comment linking /ulid-primary-keys/

    on “Exploring Alternatives to UUIDv4; Enter ULIDs”
  6. It's likely a function of the fact that `gen_random_uuid()` is implemented in C [0], and is essentially just reading from `/dev/urandom`, then modifying the variant and version bits. Whereas, assuming they're using something like what was described here [1], that's a lot of function calls within Postgres, which slows it down. As an example, this small function that makes UUIDv4: postgres=# CREATE OR REPLACE FUNCTION…

    Comment linking /ulid-primary-keys/

    on “Exploring Alternatives to UUIDv4; Enter ULIDs”

Search all of HN for blog.daveallie.com