Blog / SQL Development

SQL Development

Writing correct, concurrent SQL — transactions, locking, data modeling, and the query patterns that hold up under real load.

22 min read

Building a Concurrent Ledger in Postgres

You have a ledger table for all your customers' accounts. You want two transactions on the same account to serialize, but transactions on different accounts to run in parallel. This post describes a solution using an advisory lock keyed on the account id.

postgresqlsql developmenttransactions