Comment

Comment by mobiuscog

It's also important to put as much thought into any synthetic key.

It's easy to just use an auto-generated sequence... but then you start having to export/import or otherwise merge data, and other manipulations that often use the primary key and find there are collisions everywhere. There can also be problems when needing to support multiple databases, or update versions.

UUIDs (or equivalent synthetic keys that are independent of the database itself) are often the best answer for this reason.

Having been bitten by sequences so many times in the past, I find them to often be more trouble than natural keys in the first place - just a lazy approach.

parent mobiuscog 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton