Hacker News new | ask | show | jobs
by DougWebb 4003 days ago
There are probably business reasons for wanting the number of accounts to never go down, but I'll give you a technical reason: the database schema.

Most big companies will have a big database holding user data, with many tables that have cross-reference fields. There is one table with the master-record for each user account, and that record's unique key is cross-referenced in many other tables that hold data related to the account, and many of those cross-reference other user accounts as well.

To delete the master record, the database schema requires deletion of all of the cross-referenced records too. But when those are also referencing other users, you'd have to delete their master records too. You can't do that, so you're not able to delete anything.

This is a naive implementation, but it's common for databases designed without forethought about record deletion. The typical solution is to add an 'active' flag field, and to do 'soft-deletes' which just sets the flag to false. The record isn't deleted, so there is no problem with references. However, now ALL of your queries need to include 'where active=true' to make sure soft-deleted records don't get displayed. That can be a huge retro-fit if you didn't plan for it from the start, and it requires extra care even if you did. Which is why it's often not done.