News for hackers. Stuff that matters.
Re:Choosing the best database primary key – INT and UUIDs al... by adileo on Friday November 04, 2022 @03:03PM (#33472028)
While working on a big data & distributed system, I started questioning myself on which is the best database primary key to be used in terms of performance, security and, functionality. Despite some articles on Stackoverflow and a couple of blog post around the web highlighting the pros of some identifiers against others, I didn't found a complete overall picture. So I decided to create this comparison table.

My next step is to understand the best way to not expose the primary key to the world, maybe an additional column with a public random id? Maybe encoding/decoding the PK with some cryptographycally secure algorithm in the REST API layer? Or better a key-value mapping cache layer between the public Id and the internal Primary Key?

Every insight is welcomed.

There are no comments on this comment yet.