Hacker News new | ask | show | jobs
by C1sc0cat 2043 days ago
Who doesn't have an auto increment Id field on every table? Ok I know its not a 100% perfect solution for a user id.

The other gotcha is using ss on ni numbers as identifiers

5 comments

> Who doesn't have an auto increment Id field on every table?

In large organizations with a lot of teams, natural primary keys make interoperability easier across databases, as opposed to a forest of artificial keys that are all different. SQL experts who advocate natural keys point to ON UPDATE CASCADE as the solution to natural keys that occasionally change.

So the absence of an auto increment Id field might be a dumb error, or might be super smart, or might be both. Both means you're a SQL expert but haven't made sure everybody else working on the project always will be.

> Who doesn't have an auto increment Id field on every table?

Anyone who exposes their id fields, e.g via APIs, and doesn't want other people gaining insights into their volumes by watching the rate of increase in id values.

I've seen a situation where old IDs were re-used for new users, like we were about to run out of numbers or something… XD

And with former users coming back, of course expecting to have their IDs back too !

This being on a paper-first (often paper-only) database, with no locking process, where we also had the issue of new users being added at the same time, for the same ID.

If only I already had been through a database course at the time…

I meant the internal auto increment id field - not the actual user id.

I think I just proved my point here.

Anyone who generates IDs outside of the database. Anyone who wants to avoid contention on sequential IDs.
What is "ss on ni"?
I read that as "social security number or national identity", the "on" being a typo.
Probably "session".