PrepZone Logo
PrepZone
Back to Database

Database · Medium

Soft delete vs hard delete — which do you pick and what are the pitfalls?

DatabaseSchema DesignSenior

Answer preview

A hard delete removes the row with DELETE. A soft delete keeps the row and flags it — deleted_at TIMESTAMPTZ — so every read must filter it out. Use soft delete where users undo, audits ask "what happened to this record", or children must stay referentially valid; use hard delete…