IT lexicon › Database › Soft delete

Soft delete

Database På svenska → Updated: 2026-07-29

Marking a row as deleted instead of removing it — typically a deleted_at timestamp. Gives you a trash bin, undo and the ability to answer "who deleted this?".

The cost is paid in every subsequent query. Every SELECT has to remember WHERE deleted_at IS NULL, and whoever forgets gets ghosts in the report. Unique indexes stop behaving as expected because a deleted row still occupies its value — the PostgreSQL fix is a partial unique index. Foreign keys still point at "deleted" rows, and the table grows forever. The alternatives are often better: move the row to an archive table, or use an event log and keep the history there. And don't forget GDPR: a soft delete is not erasure in the legal sense when a user asks to be forgotten.

← Back to the lexicon