KDBS against PostgreSQL 18.6, statement by statement

Insert, update, read and join on KDBS and on PostgreSQL 18.6 at its defaults, on the same host and device. KDBS writes faster and walks a table faster, a key-anchored join runs at almost twice the speed, a primary-key read is even, and whole-table folds run at about two thirds of PostgreSQL's rate.

This post compares KDBS and PostgreSQL 18.6 one statement type at a time: insert, update, commit, read, and join. Workloads are left out. How these statements add up inside a booking transaction or a backtest is the subject of a separate post. Every number here comes from the run of 2026-10-20 on KDBS 9682b725 with the client at a40882af (v3.3.0-38), set against PostgreSQL 18.6 measured on the same host that day.

PostgreSQL is the floor here, not the target. A result well below it means something is wrong with the engine. A result above it says that statement is fine, and nothing more.

In short:

  • Writes are faster. A single-row insert or update inside a transaction takes 0.75x to 0.88x of PostgreSQL’s median latency. Batched inserts run at 1.26x to 1.30x of PostgreSQL’s rate.
  • A commit costs the same on both engines. Both wait for the same fsync, so a durable autocommit insert is even (1.04x).
  • A primary-key read is even. KDBS’s round trip is a few microseconds slower on a large table and faster on a small one.
  • A table walk is faster. An unreturned row costs KDBS about 26 ns against PostgreSQL’s 39 ns, so an unindexed filter pulls ahead as the table grows: 0.81x at 252 rows, 1.18x at 10,080, 1.43x at 60,480.
  • Joins anchored on a key run 1.76x to 1.98x faster. A correlated EXISTS runs at 2.09x.
  • The p99 mostly follows the median. KDBS’s tail is shorter on every write and on the commit (1.05x to 1.41x), and longer on the reads that are slower at the median.
  • Reads that return many rows are slightly behind, at 0.85x to 0.96x. Whole-table folds (COUNT, MIN, MAX, SUM, COUNT(DISTINCT)) are the clearest gap, at 0.68x.

How it was measured

KDBSPostgreSQL
Versionengine 9682b725, Release build; client a40882af (v3.3.0-38), table walks on the previous client (v3.3.0-33)18.6, built from source with stock -O2
Settingsdefaults, plus buffer_pool_frames = 65536; cores = 1 and durability = group unless stateddefaults: shared_buffers = 128MB, synchronous_commit = on, fsync = on
Durable at the replyyesyes
Dataa fresh data file per cell, on ext4one cluster on the same ext4 device
ClientPython driver over the KWP wire protocolPython twin of the same driver over the PostgreSQL wire protocol

The host is one 8-vCPU VM (AMD EPYC 9V74, 4 cores × 2 threads, Linux 7.0), and the client shares those CPUs with the server. Both engines reply to COMMIT only after the commit record is on disk. PostgreSQL with synchronous_commit = off does not do that, so it appears nowhere below.

The rules each number follows:

  • Three runs per cell, and the median is reported. The spread of a cell is (max − min) / median over its runs. A difference smaller than the larger spread is not a result, and a cell whose spread is above 20% is not read at all.
  • One statement at a time on one connection. Every statement below is sent serially, so a statement’s time is a fixed round trip plus a cost per row it walks or returns.
  • Never concurrent. A gate held each KDBS cell until no build or test process was running, and a one-second monitor checked each cell’s window afterwards. Five cells overlapped a foreign process and were run again.
  • One binary. Every KDBS server started from a hashed copy of the same binary.

The table walks come from the morning run. PostgreSQL’s cells ran in the morning, in the same window as a KDBS run on the same engine binary with the previous client. Three hours later, the host walked the large integer tables 11% to 17% more slowly with either client, and the run did not explain why. For the statements that walk a large table and return a handful of rows, this post therefore uses the morning’s KDBS cells, measured alongside PostgreSQL. The client change does not touch those statements: run interleaved, the new client reads them at 1.02x of the old one. Every other number is from the later run.

Ratios are KDBS over PostgreSQL: above 1.00x means KDBS is faster. For latencies, a shorter bar is faster.

Insert

A transaction’s cost is the statements plus one durable commit. The fewer commits per row, the less the device sets the rate. The batch sweep inserts 2,000 rows into a five-column table at each batch size:

Insert throughput by rows per transaction · KDBS over PostgreSQL
1 row (autocommit)768 vs 739 rows/s1.04x
10 rows5,534 vs 5,248 rows/s1.05x
100 rows15,799 vs 12,149 rows/s1.30x
1,000 rows20,868 vs 16,505 rows/s1.26x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

With one row per transaction, both engines wait for one fsync per row, and they are even. Once the commit is spread over 100 rows or more, the insert path itself sets the rate: 47.9 µs per row on KDBS against 60.6 µs on PostgreSQL.

Bulk loads show the same thing. The backtest loads three tables of 7,560 to 60,480 rows, 200 rows per transaction, at 1.47x to 1.65x of PostgreSQL’s rate:

Bulk load, 200 rows per transaction · KDBS over PostgreSQL
Sessions, 7,560 rows21,906 vs 13,293 rows/s1.65x
Bars, 60,480 rows19,626 vs 13,337 rows/s1.47x
Daily stats, 60,480 rows19,197 vs 12,949 rows/s1.48x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

An insert inside a larger transaction is also cheaper. These are the median latencies of two single-row inserts, measured inside a transaction that also reads and updates:

Single-row INSERT inside a transaction · median latency
KDBSPostgreSQL
7-column row
63.9 µs
81.0 µs
4-column row
47.6 µs
54.1 µs

Update

The run measures one kind of update: a single row located by its primary key, inside a transaction. KDBS is about a quarter faster on both statements:

Single-row UPDATE by primary key · median latency
KDBSPostgreSQL
UPDATE ... SET one or two columns WHERE id = ?
55.7 µs
72.5 µs
UPDATE ... SET one column WHERE id = ?
51.9 µs
69.5 µs

That is 0.77x and 0.75x of PostgreSQL’s latency. KDBS writes an update in place and copies the previous version to an undo record, so an update leaves no dead copy in the table for a vacuum to clean up (see No vacuum, no planner). Updates that touch many rows, and DELETE, were not measured in this run.

Commit

COMMIT, durable · median latency
KDBSPostgreSQL
KDBS, group
1,209.8 µs
PostgreSQL, synchronous_commit = on
1,278.8 µs

The commit is the device’s fsync on both engines: 0.95x of PostgreSQL’s latency, inside the noise. A single client waits for its own fsync, and the device decides how long that takes. A commit costs about 25 times as much as the write statements above, so one durable client is commit-bound on either engine. See Durability and the write-ahead log for how group batches commits across connections.

Read

By primary key

Primary-key read · KDBS over PostgreSQL
SELECT * WHERE id = ?, 252-row table13,408 vs 9,990 qps1.34x
SELECT three columns WHERE id = ?, 2,000-row table14,859 vs 14,925 qps1.00x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

A one-row read is a round trip, and the two engines are even on it. KDBS’s fixed cost (client, socket, parse, one btree descent) is 74 µs on a 252-row table against PostgreSQL’s 100 µs, and 79 µs on a 60,480-row table against PostgreSQL’s 68 µs. Inside the booking transaction, three primary-key reads take 1.04x to 1.12x of PostgreSQL’s latency, a difference of 3 to 10 µs. The 1,008, 10,080 and 60,480-row cells of this shape had spreads above 20% and are not read.

By a filter on an unindexed column

A filter on a column with no index walks the whole table. That makes it a direct measure of how fast each engine reads a row it does not return:

SELECT * WHERE session_no = ?, 8 rows returned, no index · KDBS over PostgreSQL
252 rows11,106 vs 13,722 qps0.81x
1,008 rows7,661 vs 7,652 qps1.00x
10,080 rows2,432 vs 2,058 qps1.18x
60,480 rows591 vs 414 qps1.43x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

The ratio climbs with the table size. An examined, unreturned row costs KDBS about 26 ns and PostgreSQL about 39 ns. On a small table the round trip dominates. On a large one the walk dominates, and KDBS pulls ahead. On a 10,000-row table in a second schema, WHERE user_id = ? with no index runs at 1.15x (2,779 vs 2,421 qps).

Reads that return many rows

Many rows returned · KDBS over PostgreSQL
Key range, 200 rows1,260 vs 1,400 qps0.90x
Filter on genre, about 125 rows2,925 vs 3,041 qps0.96x
Date-range filter, 10,000-row table913 vs 1,063 qps0.86x
Two-column filter, 10,000-row table1,126 vs 1,135 qps0.99x
Filter returning 7,560 rows27.3 vs 32.3 qps0.85x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

When a statement returns many rows, the cost of each returned row sets its speed. KDBS pays 3.6 µs per returned row on a key range, against PostgreSQL’s 3.2 µs. That figure holds at every table size from 252 to 60,480 rows, so it is a cost per row, not per table. Most of it is the Python client decoding and rendering the row, on both sides. On the 7,560-row read, the gap is 4.84 µs per row against 4.08 µs, and at least half of that 0.76 µs comes from KDBS sending its reply only when the statement finished, so the server’s work and the client’s could not overlap. A later change streams the reply in batches as the walk proceeds. It is not in these numbers.

With an index

Equality and range filters with an index, 10,000-row table · KDBS over PostgreSQL
WHERE user_id = ?11,682 vs 10,834 qps1.08x
SELECT COUNT(*) WHERE user_id = ?14,859 vs 11,521 qps1.29x
WHERE genre = ?3,158 vs 3,755 qps0.84x
WHERE status = ? AND due_day BETWEEN ? AND ?1,591 vs 1,911 qps0.83x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

An index buys both engines about the same factor: 4.77x on KDBS and 4.47x on PostgreSQL for WHERE user_id = ? at 10,000 loans. The shapes behind PostgreSQL here are the ones that still return many rows through the index.

Whole-table folds

Aggregates over a 60,480-row table · KDBS over PostgreSQL
COUNT, MIN, MAX, SUM165 vs 244 qps0.68x
COUNT(DISTINCT symbol_id)167 vs 245 qps0.68x
GROUP BY symbol_id, 8 groups133 vs 146 qps0.91x
GROUP BY session_no, 7,560 groups46 vs 50 qps0.92x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

A fold over the whole table returns one row, so the client is not the cost here. KDBS folds a row more slowly than PostgreSQL does. The gap is 0.68x on the plain aggregates, and grouping narrows it to 0.91x and 0.92x. This is the largest gap the run shows that belongs to the engine.

Join

Joins · KDBS over PostgreSQL
Anchored on a key
3 tables from a primary key, 252 bars12,569 vs 6,354 qps1.98x
3 tables from a primary key, 1,008 bars12,521 vs 7,120 qps1.76x
3 tables from a primary key, 10,080 bars12,855 vs 7,010 qps1.83x
A filtered walk probing two tables by key
1,008 bars6,330 vs 3,399 qps1.86x
10,080 bars2,252 vs 1,682 qps1.34x
Two tables, 10,000 loans
JOIN ... WHERE u.id = ?, indexed10,091 vs 8,929 qps1.13x
JOIN ... WHERE u.id = ?, no index2,728 vs 2,327 qps1.17x
JOIN on a key range, no literal, indexed4,374 vs 1,478 qps2.96x
JOIN on a key range, no literal, no index1,683 vs 1,504 qps1.12x
Correlated EXISTS, no index1,608 vs 768 qps2.09x
Correlated EXISTS, indexed7,468 vs 5,128 qps1.46x
Many rows returned
Filtered join, 359 rows, 60,480 bars1,030 vs 1,092 qps0.94x
0.5x1x2x
← PostgreSQL fasterKDBS faster →

The join that starts from a primary key (bar → symbol → exchange, WHERE b.id = ?) runs at 1.76x to 1.98x of PostgreSQL’s speed at every size, and its throughput does not move with the table size: 12,521 to 12,855 qps from 252 to 10,080 bars. Each step is a btree descent.

The join of users and loans over u.id BETWEEN 1 AND ... has no literal to push down. With an index on the join column, KDBS probes it for each outer row and runs at 2.96x. PostgreSQL gains nothing from the same index here (0.98x of its own unindexed rate), so the ratio measures the plan PostgreSQL chose as much as either engine’s speed. The correlated EXISTS is ahead with or without an index.

KDBS orders the tables of an inner join from statistics. On the two joins it reordered, that choice is worth 6% to 7% over the written order. The join that returns 359 rows is at 0.94x for the per-row cost described under reads.

The tail: p99

The charts above compare medians. The p99 latency asks a different question: how slow is the slow 1%. Both drivers record every statement’s latency, so the tail can be compared on the same statements:

p99 latency · PostgreSQL's p99 over KDBS's, above 1 means KDBS's tail is shorter
Write
INSERT, 200 rows per transaction83.9 vs 118.3 µs1.41x
INSERT inside a transaction, 7 columns104.4 vs 127.2 µs1.22x
INSERT inside a transaction, 4 columns92.2 vs 97.1 µs1.05x
UPDATE by primary key, one or two columns98.5 vs 113.8 µs1.16x
UPDATE by primary key, one column96.5 vs 110.2 µs1.14x
COMMIT, durable2,122 vs 2,650 µs1.25x
Read
Primary-key read, 4,000-row table133.9 vs 117.2 µs0.88x
Key range, 200 rows811.7 vs 759.0 µs0.94x
Filter returning 93 rows193.0 vs 134.7 µs0.70x
Unindexed filter with GROUP BY, 60,480 rows1,767 vs 2,615 µs1.48x
Unindexed WHERE user_id = ?, 10,000 loans416.5 vs 447.9 µs1.08x
Date-range filter, 10,000 loans1,181 vs 1,284 µs1.09x
COUNT(*) WHERE user_id = ?, indexed89.3 vs 134.1 µs1.50x
Join
Filtered walk probing two tables by key1,920 vs 2,851 µs1.48x
Correlated EXISTS, no index673.2 vs 1,353.7 µs2.01x
Correlated EXISTS, indexed155.1 vs 229.0 µs1.48x
0.5x1x2x
← PostgreSQL fasterKDBS faster →
StatementKDBS p50KDBS p99PostgreSQL p50PostgreSQL p99
INSERT, 200 rows per transaction45.8 µs83.9 µs67.4 µs118.3 µs
INSERT inside a transaction, 7 columns63.9 µs104.4 µs81.0 µs127.2 µs
UPDATE by primary key, one column51.9 µs96.5 µs69.5 µs110.2 µs
COMMIT, durable1,209.8 µs2,121.9 µs1,278.8 µs2,650.1 µs
Primary-key read, 4,000-row table88.0 µs133.9 µs78.4 µs117.2 µs
Key range, 200 rows781.4 µs811.7 µs721.7 µs759.0 µs
Date-range filter, 10,000 loans1,108.4 µs1,181.4 µs933.3 µs1,284.3 µs
Correlated EXISTS, no index621.4 µs673.2 µs1,303.1 µs1,353.7 µs

The tail mostly follows the median. Where KDBS is faster at p50 it is also faster at p99, and where it is slower at p50 it is slower at p99. The durable commit has the clearest gap in the tail: KDBS’s p99 is 1.75x its median, PostgreSQL’s 2.07x. The date-range filter is the one statement that changes sides. Its median is 0.84x of PostgreSQL’s speed, but PostgreSQL’s p99 sits 38% above its median and KDBS’s only 7%, so at p99 KDBS is ahead.

Each run gives one p99 per statement, and the figure reported is the median over three runs. Each run executes the statement 200 to 60,480 times, so on a 200-statement shape the p99 is close to the second-slowest sample. A statement is left out when either engine’s p99 varies by more than 20% across its runs. That rule drops the key-anchored join, the primary-key read on the 2,000-row table, and the joins with no literal. The rows that walk a large table come from the morning run, as above.

Where the time goes

A serial statement is a fixed round trip plus a cost per row. The run separates the terms:

CostKDBSPostgreSQLKDBS / PG time
Fixed round trip, 252-row table74.4 µs99.8 µs0.75x
Fixed round trip, 60,480-row table79.1 µs68.0 µs1.16x
Each examined, unreturned rowabout 26 nsabout 39 ns0.67x
Each returned row, 9-column key range3.57 µs3.23 µs1.11x
Each inserted row, commit amortised (1,000 per transaction)47.9 µs60.6 µs0.79x
One durable commit1,254 µs1,292 µs0.97x

KDBS is cheaper at walking a row and writing a row, and slightly more expensive at returning a row. The table explains the charts above: KDBS leads where the work is a walk or a write, is even where a round trip or an fsync dominates, and trails where the rows returned or folded set the cost.

What this run does not show

  • Concurrency. Every statement here ran on one connection. How the engines scale with clients is in the workload post.
  • DELETE, and updates of many rows. Neither was measured.
  • PostgreSQL tuned. Both engines ran at their defaults. A tuned PostgreSQL, or one with different indexes, would move some rows.
  • The latest engine. The reply streaming mentioned under reads came after this run, and it is not in these numbers.
  • Other hardware. One VM, one ext4 device, clients on the same CPUs. A faster device could move the commit-bound rows in either direction.

Read the raw numbers

Every cell’s JSON, the run scripts and the write-ups are in the repository under bench/v3.3.0/, starting from the summary. The statements above are taken from the scenario drivers (tools/scenario1_backtest.py, tools/scenario2_freight.py, tools/scenario3_library.py) and their PostgreSQL twins. To get a feel for the engine first, try the sandbox, or run a server.

More from the blog