---
title: "The Write Last, Read First Rule"
description: "When an application spans two stores without a shared transaction boundary, such as Postgres for account master data and TigerBeetle for the ledger, one must be designated the system of record and the other the system of reference."
url: "https://swe.quest/articles/the-write-last-read-first-rule-6fa0042a5ce38b5c"
canonical: "https://tigerbeetle.com/blog/2025-11-06-the-write-last-read-first-rule"
source: "TigerBeetle"
published: "2025-11-06"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 8
tags: ["consistency","distributed-systems","payments","resilience","typescript"]
---

# The Write Last, Read First Rule

A post on [TigerBeetle](https://swe.quest/sources/tigerbeetle.md), published 2025-11-06, 8 min read, Deep dive. Original: [https://tigerbeetle.com/blog/2025-11-06-the-write-last-read-first-rule](https://tigerbeetle.com/blog/2025-11-06-the-write-last-read-first-rule)

## Summary

When an application spans two stores without a shared transaction boundary, such as Postgres for account master data and TigerBeetle for the ledger, one must be designated the system of record and the other the system of reference. Writes go to the system of reference first and the system of record last, and existence checks read the system of record first. This keeps the system traceable: no funded ledger account ever lacks an owner record, even if it is temporarily inconsistent. The approach is implemented with Resonate's durable execution (Distributed Async Await) and idempotent per-store create functions. A result matrix classifies outcomes as success, recovery, conflict or ordering violation, and the application panics to alert an operator on violations.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Consistency models](https://swe.quest/tags/consistency.md) (Distributed systems)
- [Distributed systems](https://swe.quest/tags/distributed-systems.md) (Distributed systems)
- [Payments & fintech](https://swe.quest/tags/payments.md) (Domains)
- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)

## Prerequisites

- database transactions ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- idempotency
- double-entry bookkeeping basics

## Keywords

TigerBeetle, PostgreSQL, Resonate, Distributed Async Await, durable execution, strict serializability

## Related posts

- [Eventually Consistent: How Do We Know the Systems Eventually Agree?](https://swe.quest/articles/eventually-consistent-how-do-we-know-the-systems-eventually-agree-446e4800453d4b35.md): Kogan.com Dev Blog · 2026-11-09 · Medium · 9 min read · Event-driven architecture, Consistency models, Resilience, PostgreSQL, E-commerce
  Eventually consistent event-driven order systems need a reconciliation job that starts from the authoritative order store, not from received messages, so orders whose events were lost (like a fraud-hold release that never reached SAP) still surface.
- [RAMP-TAO: Layering atomic transactions on Facebook’s online graph store](https://swe.quest/articles/ramp-tao-layering-atomic-transactions-on-facebook-s-online-graph-store-470552a388260a08.md): Meta Engineering · 2021-08-18 · Hard · 2 min read · Consistency models, Distributed databases, Caching, Distributed systems
  RAMP-TAO is a protocol that layers read-atomic transactional guarantees on top of TAO, Facebook's eventually consistent social graph store, so developers get an intuitive read transaction API without handling fractured-read anomalies.
- [What you get when you think of Postgres storage as a transaction journal](https://swe.quest/articles/what-you-get-when-you-think-of-postgres-storage-as-a-transaction-journal-a74912c90f281399.md): Neon · 2024-05-01 · Medium · 9 min read · PostgreSQL, Storage engines, Replication, Distributed databases
  Neon treats Postgres storage as a transaction journal: the write-ahead log becomes the source of truth instead of a recovery aid.
- [Deno KV internals: building a database for the modern web](https://swe.quest/articles/deno-kv-internals-building-a-database-for-the-modern-web-61dddae321d95df6.md): Deno · 2023-09-14 · Hard · 10 min read · Distributed databases, Consistency models, Storage engines, JavaScript
  Deno KV's production backend runs on FoundationDB, with a custom "transaction layer" in front of it that handles multi-tenant configuration, JavaScript-native types such as bigint sums, and cross-region replication.
- [How we built a general purpose key value store for Facebook with ZippyDB](https://swe.quest/articles/how-we-built-a-general-purpose-key-value-store-for-facebook-with-zippydb-852970eb82fe8238.md): Meta Engineering · 2021-08-06 · Hard · 10 min read · Distributed databases, Replication, Consistency models, Consensus, Multi-tenancy
  ZippyDB is Facebook's largest strongly consistent, geo-distributed key-value store, built by layering a reusable replication library (Data Shuttle) on RocksDB, Shard Manager and a ZooKeeper-based config service.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
