logoalt Hacker News

tyre • yesterday at 8:22 PM • 3 replies • view on HN

So you have a second, opaque unique identifier for the frontend to fetch? At that point why not just use a single column (UUID)?


Replies

crazygringo • yesterday at 10:02 PM

Yes, this is standard. And the point is performance. The needs of user-facing ID's (short alphanumeric, randomly ordered) tend to be pretty orthogonal to the needs of internal ID's (raw bits, monotonically increasing, maybe timestamp data).

➕ show 1 reply
ndriscoll • yesterday at 8:37 PM

Higher density for indexes you use for joins. Also you can then use UUIDv4 to hide creation times if that's sensitive too.

➕ show 1 reply
nextaccountic • today at 1:59 AM

It makes more sense to have two columns yes, one autoincrement for the primary key, and another uuidv4. Because uuids are too large and makes indexes slower