Notebook contents

When a Firestore summary is worth the extra write

A compact overview can replace a page of document reads. The trade-off is keeping that second copy small, current, and easy to rebuild.

Start with what the screen needs

Imagine a repair desk that opens a list of 40 requests several times a day. The list needs a title, status, and due date. The full records also contain attachments and work history. A compact summary can serve the list in one document read. Open a request to load its full record. The example below uses made-up data.

Request overview
  18  Replace hallway light
      In progress · 24 Nov
  19  Repair cabinet hinge
      Planned · 26 Nov

Keep one authoritative record

I keep the full request authoritative and derive the summary from it. When both need to agree immediately, I write them in the same Firestore transaction, including when a request leaves the list. Follow-up work waits for the commit because Firestore can retry the transaction callback. The full records still drive access checks and can rebuild the summary.

Measure the trade-off

Every change that affects the overview costs an extra write. A growing summary carries more bytes, and concurrent edits can compete for the same document. I start with a bounded view and measure reads, payload size, and transaction retries. For a growing list, I’d compare a paginated query with partitioned summaries. For a count alone, I’d start with a Firestore aggregation query.

Firestore transactions · Firestore single-document write guidance