Estimate project
← All posts

TigerBeetle vs PostgreSQL Performance: How We Set Up the Benchmark and Local Test Results

This article explains how the tests were designed and presents the results of the first local, single-node runs.

8 min read
PerformanceRustbenchmarkPostgreSQLTigerbeetledatabase

A while back we wrote about what makes TigerBeetle interesting: a replicated, highly available financial database with a fixed schema and a focus on performance. TigerBeetle makes a series of intriguing design decisions, all geared toward building a system that delivers “1000x performance” and can drive the next generation of financial workloads.

Time to test both the design and those claims! We’ll benchmark TigerBeetle against PostgreSQL, the relational database most people reach for by default. This article explains how the tests were designed and presents the results of the first local, single-node runs. In the follow-up, we’ll test a complete cluster with data replication, running in isolation on dedicated servers.

Designing the test: PostgreSQL schema

TigerBeetle’s schema is fixed and supports (only) double-entry bookkeeping. It revolves around three entities: ledgers, accounts and transfers. Every transfer touches two accounts – one gets credited, the other debited. Creating transfers is the core database operation, and it’s the one this benchmark exercises.

For a fair comparison, we’ll build a PostgreSQL schema modeled on TigerBeetle’s, albeit somewhat simplified. It contains only the fields the tests actually use (leaving out ledgers, user data, timeout, codes, flags & linked transfers):

CREATE TABLE IF NOT EXISTS accounts (
    id BIGINT PRIMARY KEY,
    balance BIGINT NOT NULL DEFAULT 0,
    CONSTRAINT balance_non_negative CHECK (balance >= 0)
);

CREATE TABLE IF NOT EXISTS transfers (
    id BIGSERIAL PRIMARY KEY,
    source_id BIGINT NOT NULL REFERENCES accounts(id),
    dest_id BIGINT NOT NULL REFERENCES accounts(id),
    amount BIGINT NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    CONSTRAINT amount_positive CHECK (amount > 0),
    CONSTRAINT different_accounts CHECK (source_id != dest_id)
);

CREATE INDEX IF NOT EXISTS idx_transfers_source ON transfers(source_id);
CREATE INDEX IF NOT EXISTS idx_transfers_dest ON transfers(dest_id);
CREATE INDEX IF NOT EXISTS idx_transfers_created_at ON transfers(created_at);

Keep in mind that we always enforce a non-negative balance; in TigerBeetle this is optional, but our transfers will have the check enabled (the debits_must_not_exceed_credits flag gets set when accounts are created).

Transfers in PostgreSQL

With the schema in place, it’s time to make some transfers! TigerBeetle only needs a create_transfer request, whereas in PostgreSQL the transfer logic has to be written in SQL.

We have a few strategies to choose from, each using PostgreSQL’s locking differently to guarantee correctness; whatever we pick, money must never be created out of thin air. A PostgreSQL transfer is made up of three operations:

  • Lowering the balance of the source account
  • Raising the balance of the destination account
  • Adding a transfer to the transfers table

To cut down on network overhead & round-trips, transfers are implemented as a stored procedure. This way, each transfer is one network call to the database, which carries out all three steps on its side.

The first approach relies on explicit locking. We start with a SELECT … FOR UPDATE that locks and reads the source & destination account balances (in the correct order, to prevent deadlocks), then UPDATE the accounts with the new values, and lastly INSERT a new transfer. You’ll find it in the transfer function.

The second approach uses implicit locking via UPDATE … SET … WHERE and checks the number of affected rows (i.e., whether the transfer went through). If it did, we INSERT a new transfer. This lives in the transfer_atomic function.

Naturally, in both cases the stored procedure runs inside a transaction block. This guarantees that a transfer is either recorded completely or rejected (never partially applied). We use the fairly weak READ COMMITTED transaction isolation level, which is enough for this workload. (Generally this differs from TigerBeetle’s strict serializability, but the PostgreSQL implementation doesn’t need guarantees that strong.)

Batching transfers in PostgreSQL

With these two strategies we can implement load tests in which TigerBeetle and PostgreSQL do comparable work when the client creates a new transfer: simply call the relevant function.

Comparing the two databases in such a naive way could be misleading, though, because TigerBeetle clients behave differently from SQL clients.

With a SQL database, you normally have a pool of pre-established connections. A client that wants to send a request grabs an open connection (if one is free) or waits for one to free up, runs the operation, and hands the connection back to the pool. A load test with many concurrent clients calling the transfer stored procedures would behave the same way.

TigerBeetle, however, works differently. Every client has exactly one database connection, with at most one request in flight at a time. While a request is outstanding, any further requests are gathered into a batch, which is sent as soon as the previous request finishes. This aggressive batching is one of the ways Tigerbeetle reaches high performance, and the client implementation handles it automatically.

But! Something similar can be built for PostgreSQL. We can write a batched client that keeps a single database connection. While the previous request is being processed, upcoming transfers are gathered into a batch. Then we call a stored procedure that processes them as a batch – one network call for many transfers.

Bear in mind that this technique is tailored to the transfer use-case – it wouldn’t work generally, since in general you can run arbitrary queries. Here, though, we can write a batch_transfers function that accepts three arrays: source accounts, destination accounts and amounts. A savepoint is created before every transfer, so the “big” batch transaction can roll back partially if a transfer fails.

The client code

The TigerBeetle and PostgreSQL clients are both written in asynchronous Rust on the Tokio runtime. This lets hundreds or thousands of executors run concurrently on a small thread pool.

The test clients support two modes: max-throughput and fixed-rate. The first measures the maximum number of transfers per second a database can sustain at a given client concurrency level (i.e., how many executors try to create transfers in a loop). The second measures transfer latency at a given rate of transfers per second and client concurrency.

In our first single-node local tests, we concentrate exclusively on max-throughput testing.

Every client goes through two phases, warmup and measurement, whose durations are configurable. All measurements are sent to Prometheus through an OpenTelemetry metrics collector.

And that’s all the client code does: in max-throughput mode, it simply bombards the database for the whole test with randomly generated transfers between randomly picked accounts (following the Zipfian distribution, which captures the fact that typically a handful of “hot” accounts get a disproportionate share of transfers).

The client code contains three PostgreSQL executors (explicit locking, implicit locking, batched) and a single TigerBeetle executor.

The coordinator

The coordinator code is responsible for launching the client(s), running several test rounds (clearing the database between them), and gathering and reporting the data.

For local runs, Grafana, Prometheus & the OpenTelemetry collector are always started with Docker. On macOS, TigerBeetle has to run directly on the host, since it relies on io_uring, which Docker doesn’t provide. PostgreSQL always runs in a Docker container.

Local test results

At last, the local test results! All tests ran on an Apple MacBook Pro with the M1 Max chip and 64GB of RAM.

In the first phase we ran several “quick” tests – 3 test iterations, each made up of a 30-second warmup followed by a 60-second measurement phase. We used these quick tests to find the best concurrency setting for every transfer executor under test.

These are the best-performing concurrency settings per executor:

Executor Concurrency Connection pool size
Tigerbeetle 24 576
Postgres explicit locking 64 16
Postgres implicit locking 64 16
Postgres batched 384

Next, using the concurrency setting that gave the best results (which differed per executor), we ran a longer test: 3 test iterations, a 2-minute warmup and a 5-minute measurement. Here’s what we got:

2026-01-19-normal-comparison

TigerBeetle reaches 42k TPS, making it 2.8 times faster than the strongest PostgreSQL implementation, Postgres-batched, at 15k TPS, and 6.6x faster than the Postgres-explicit-locking approach. That’s a substantial gap (though not 1000x)!

Bear in mind that TigerBeetle hits this throughput at a far higher concurrency setting, which produces bigger batches. At lower concurrency settings, throughput drops too:

2026-01-18-tigerbeetle-quick

This chart shows the results of the “quick” tests, in which TigerBeetle reached an even higher throughput (60k TPS) than in the long-running ones.

Test limitations

Remember that we’re testing one particular usage scenario – many clients running concurrently (corresponding, e.g., to incoming HTTP requests), each creating a single transfer. Performance could look completely different if batching happened at another level and transfers came in already batched (e.g., up to a batch size of 8192, TigerBeetle’s maximum).

So while the test above can give you a sense of how TigerBeetle compares with PostgreSQL, be sure to benchmark your own workload before deciding anything – the outcome may be quite different!

Next steps

Local, single-node tests don’t paint the full picture – they merely hint at how performance could look in a “real” production setup.

That’s why the next part will examine the performance of replicated clusters – the way TigerBeetle is meant to be deployed – running on dedicated servers. Stay tuned!