liveBook · Manning

Soft delete

As explained in Crack Any Codebase with AI

A soft delete marks a record as deleted while retaining it in the database, typically with a deletion timestamp.

Soft deletion marks a record as deleted while retaining it in the database, typically with a deletion timestamp. That preserves recoverability, but it also makes deletion behavior part of every relevant query and index decision. section 7.6

Treat soft deletion as a schema-and-query investigation:

  • Check which queries must exclude deleted rows; an apparently correct query can become unsafe when the deletion condition is omitted. section 7.6
  • Inspect indexes against the resulting filter shapes rather than assuming the schema explains its own performance. section 7.6
  • Account for write amplification: each added index speeds selected reads but adds work to inserts and indexed updates. section 7.6

A production-scale warning

The Booking table has eight indexes because bookings are read frequently and created rarely. Reusing that pattern for an append-only audit log would make writes much more expensive for an infrequent search. section 7.6

How Crack Any Codebase with AI covers it

How deep it goes
Defines retention-based deletion and flags query, index, and write-cost consequences without detailing implementation mechanics.
Examples
Uses the indexed Booking table and append-only audit log to illustrate read optimization versus write cost.
What you can do after
Diagnose soft-deletion risks by checking exclusion filters, index coverage, and write amplification.
How it connects
Connects soft deletion with database schema, indexes, query filters, foreign keys, and write amplification.

Also explained in

Compare how 3 books explain soft delete →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Crack Any Codebase with AI. The section links point to the parts of the book it draws on.