Delete MySql rows, or mark "dead"?
Question by johnnietheblack
I’ve always had a weird feeling in my gut about actually deleting rows from certain types of tables.
For example, if I have a table of Users…when they delete their account, rather than fully deleting their row, I have been marking as “dead” or inactive. This allows me to retain a record of their existence if I ever need it again.
In situations like this – considering performance, overhead, etc – should I delete the row, or simply mark as inactive?
Which is more “common”?
Answer by Eric Petroelje
Personally, I almost always use “soft deletes” as you describe.
If space is a concern, I’ll have a job that will periodically clean up the soft-deleted records after they’ve been deleted for a certain amount of time.
Answer by Starx
Data are very valuable to be permanently deleted from the database. Mark as dead
.
I generally give status for such cases. In this pattern
0
Inactive1
Active2
Trashed