There is no application code: tables, SQL functions and views install into the same database as the app, so a ledger write commits atomically with the rest of its transaction. Any language posts transfers by calling functions and reads balances through views.
- 13,557/sTransfers (M3 Air)
- 9,306/sContended (10 accounts)
- 774Bytes per transfer
Trade-offs
- All logic in PostgreSQL, no application layer. It works across languages and commits atomically with the rest of the app, because every transfer is a SQL call in the same database.
- Idempotency keys are optional. They make retries safe, at a measured 11,481 transfers/s against 13,557 and 951 bytes per transfer against 774.
- Balance constraints are checked after each request, not at batch end. Limits hold at every step, but the same batch can pass in one order and be rejected in another.
Q&A4
Each call collects its account IDs, sorts them and takes
FOR UPDATE locks in that order.Under Read Committed the calls wait for each other, and the later ones return the transfers already created. A retry with different arguments is an error.
Every entry records the previous and current balance. The row to read is the latest before the wanted time, ordered by
account_version, because entries from one batch share a created_at.Accounts are single currency, so an exchange uses four accounts, two of them liquidity accounts, and two transfers in one call. Debits and credits still sum to zero per currency.
Links
Built by
Reviews
Loading reviews
More in Postgres
See all 25 →
SupermetryCookie-free web and product analytics on one Go binary and PostgreSQL
arbiterPostgreSQL job queue for Haskell, with no broker and no leader- StreambedPostgres-to-Iceberg CDC engine with a built-in Postgres wire query server
MigrationPilotPostgreSQL migration linter that blocks unsafe DDL before merge
go-ledgerMulti-tenant double-entry payment ledger API in Go, built in public- pistachioDeclarative PostgreSQL schema management with a plan and apply workflow
More in Fintech
See all 21 →
FinTrackEvent-driven personal finance platform on Spring Boot, SQS and PostgreSQL
OffPayOffline UPI payments over *99# USSD, with no data connection
HisabDouble-entry ledger kept by texting a WhatsApp agent, in Urdu or English
PandaPayLensPayment error decoder and event timeline that runs in the browser
Edge ScannerLocal intraday stock scanner with setups built without code
Accountant24Personal finance agent that keeps an hledger ledger in plain text under git
More in Ledgers
See all 7 →- FinCore EngineSelf-hosted JVM core for a double-entry ledger, payments and compliance
- franken_accountingEvidence-native double-entry accounting system of record in Rust