# Benchmarks

Throughput of Managed PostgreSQL per machine type for a transactional, a read-heavy and a write-heavy workload, with the setup to run the same yourself.

Measured on 2026-11-12 in `de1`, on a 21 GB database, unless a section says otherwise. These
numbers are measurements, not guarantees: there is no published service-level objective for
throughput.

## Terms

| Term           | Meaning                                                                                                                                               |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **tps**        | Transactions per second, as reported by `pgbench`, excluding connection time.                                                                         |
| **tpcb**       | `pgbench`'s built-in TPC-B-like transaction: three updates, one select, one insert.                                                                   |
| **select**     | `pgbench -S`: one primary-key lookup in a 100-million-row table.                                                                                      |
| **shop-read**  | A customer's ten latest orders with their item counts: a join of `orders` and `order_lines` through an index, for a random customer out of 2 million. |
| **shop-write** | Placing an order: insert the order and three order lines priced from `products`, update the order total and three stock counts, in one transaction.   |

## Choose a machine type

- **Reads** grow with memory and CPU: more of the data is cached, more queries run at once.
- **Writes** are bounded by the data volume. Every commit waits for one write to disk, about 5 ms on
  the network volume, so more CPU or memory does not raise them; dedicated CPU (`ccx`) does help.
- **A cluster with synchronous replication** commits one standby write later, which costs 30–50 %
  of small-transaction write throughput at 16 clients and about half of a bulk load. Reads are
  unaffected.

## Single node

| Machine         | vCPU / memory       | tpcb  | select | shop-read | shop-write |
| --------------- | ------------------- | ----- | ------ | --------- | ---------- |
| `performance-4` | 4 shared / 8 GB     | 1,141 | 2,810  | 820       | 875        |
| `performance-8` | 8 shared / 16 GB    | 1,206 | 5,365  | 1,665     | 838        |
| `dedicated-4`   | 4 dedicated / 16 GB | 1,574 | 5,003  | 2,674     | 1,086      |
| `dedicated-8`   | 8 dedicated / 32 GB | 1,880 | 17,036 | 24,425    | 1,338      |

On `dedicated-8` the whole 21 GB fits in memory, so reads no longer touch the volume: shop-read is 9×
`dedicated-4`'s. Measured warm; the first run after a resize, with an empty cache, gave 394 shop-read and
684 shop-write.

## Cluster, on the leader (3 × performance-4)

| Replication | tpcb (three runs) | select | shop-read | shop-write (three runs) |
| ----------- | ----------------- | ------ | --------- | ----------------------- |
| `async`     | 1,162 / 714 / 835 | 2,429  | 424       | 485 / 603 / 665         |
| `sync`      | 568 / 473 / 287   | 3,119  | 536       | 449 / 547 / 375         |

The two modes were run alternately on the same machines, minutes apart. The spread between runs
shows how much shared-CPU machines and network volumes vary; compare ranges, not single numbers.

## Where the leader is (spread cluster, 3 × performance-4, sync)

A spread cluster's load balancer is in de1a, and a failover promotes a de1a standby before the
de1b one, so the leader is normally in de1a. With the leader in de1b, every commit crosses zones
twice: to the leader, and for its synchronous acknowledgement back from the de1a standby. Measured
in the zone tests finished on 2026-11-13: one client through the load balancer and the pooled
endpoint (6432), 4.5 GB of data (pgbench scale 300), 60 s per run:

| Leader in     | One connection, one-row commits: latency / commits per second | pgbench tpcb, 8 clients (tps) |
| ------------- | ------------------------------------------------------------- | ----------------------------- |
| de1a (3 runs) | 9.3 ms / 108 · 8.5 ms / 118 · 6.8 ms / 148                    | 307 · 306 · 347               |
| de1b (2 runs) | 11.6 ms / 86 · 12.1 ms / 83                                   | 206 · 210                     |

About 3 ms more per commit and a third less throughput while the leader is in de1b. **Nodes** tells
you when that is the case ("The primary is in de1b, away from the balancer in de1a …"); **Switch
over** brings it home (see
[Fail over a cluster](fail-over-a-cluster.md)).

## Storage under the database

| 8 KB operations                          | Data volume             | For comparison: a `performance-8`'s local disk |
| ---------------------------------------- | ----------------------- | ---------------------------------------------- |
| Random writes, 32 in flight              | 7,500/s, average 4.3 ms | 74,000/s, average 0.4 ms                       |
| Sequential write + flush (like a commit) | 199/s, 5 ms each        | 2,663/s, 0.37 ms each                          |
| Random reads, 32 in flight               | 7,000/s                 | —                                              |

Data volumes are encrypted (LUKS2) and grow while the database runs; the database therefore lives
on one rather than on the machine's local disk. You
cannot choose the storage behind a database.

## Run the same benchmark

1. Create the database and a compute instance in the same region and network (the client used
   here: `performance-8`, 8 vCPU).
2. Load the data: `pgbench -i -I dtGvp -s 1000` (server-side generation, 100 million accounts,
   about 15 GB), plus the shop tables below.
3. Run each workload for 120 s after a `CHECKPOINT`, over the private address on port 5432 with
   `sslmode=require`:

```sh
pgbench -n -T 120 -c 16 -j 8                          # tpcb
pgbench -n -T 120 -c 32 -j 8 -S                       # select
pgbench -n -T 120 -c 32 -j 8 -f shop-read.sql         # shop-read
pgbench -n -T 120 -c 16 -j 8 -f shop-write.sql        # shop-write
```

`shop-read.sql`:

```sql
\set cid random(1, 2000000)
SELECT o.id, o.status, o.total_cents, o.created_at, sum(l.qty) AS items
FROM orders o JOIN order_lines l ON l.order_id = o.id
WHERE o.customer_id = :cid
GROUP BY o.id ORDER BY o.created_at DESC LIMIT 10;
```

`shop-write.sql` (needs `CREATE SEQUENCE bench_order_id START 20000001`):

```sql
\set cid random(1, 2000000)
\set p1 random(1, 50000)
\set p2 random(1, 50000)
\set p3 random(1, 50000)
BEGIN;
SELECT nextval('bench_order_id') AS oid \gset
INSERT INTO orders (id, customer_id, status, total_cents, created_at) VALUES (:oid, :cid, 'paid', 0, now());
INSERT INTO order_lines (order_id, line, product_id, qty, price_cents)
  SELECT :oid, v.l, v.p, 1, products.price_cents FROM (VALUES (1, :p1), (2, :p2), (3, :p3)) v(l, p) JOIN products ON products.id = v.p;
UPDATE orders SET total_cents = (SELECT sum(qty * price_cents) FROM order_lines WHERE order_id = :oid) WHERE id = :oid;
UPDATE products SET stock = stock - 1 WHERE id IN (:p1, :p2, :p3);
COMMIT;
```

The shop tables: `customers` (2 M rows, a `jsonb` column with a GIN index), `products` (50 k),
`orders` (10 M, indexed on `(customer_id, created_at)` and `created_at`), `order_lines` (30 M,
foreign keys to both). With pgbench's tables the database is 21 GB.

## Other providers

As of 2026-11-12, STACKIT, IONOS and T Cloud Public did not publish throughput figures for their
managed PostgreSQL. The figure closest to one is a third-party test commissioned by T Cloud Public
in March 2024: a different benchmark (BenchBase TATP) on a single 16 vCPU / 64 GB instance, about
57,000 operations per second.
It is not comparable with the numbers above.

## Related

- [Resize a database](resize-a-database.md)
- [Choose synchronous or asynchronous replication](set-the-replication-mode.md)
- [Troubleshooting](troubleshooting.md): throughput below these numbers.
