Soft Delete vs Hard Delete — What's the Difference?

A hard delete permanently removes a row from the database; a soft delete instead marks a row as deleted (typically with a deleted_at timestamp or is_deleted...

Published October 6, 2026

A hard delete permanently removes a row from the database; a soft delete instead marks a row as deleted (typically with a deleted_at timestamp or is_deleted flag) while keeping it in the table.

Why they differ

  • Hard deletes free up storage immediately and simplify the schema, but data is genuinely unrecoverable afterward
  • Soft deletes preserve an audit trail and make "undo" possible, but every query must remember to filter out soft-deleted rows

How to choose

  • Use soft deletes when data might need to be restored, audited, or referenced later, such as user accounts or orders
  • Use hard deletes for genuinely disposable data, or when legal/privacy requirements (like GDPR deletion requests) mandate permanent removal

FAQ

Does soft deleting affect unique constraints?

Yes, often awkwardly — a unique constraint on, say, email won't let you reuse an email from a soft-deleted row unless the constraint is specifically designed to exclude deleted rows (e.g. a partial/filtered unique index).

More SQL articles