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
EXISTSruns 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
| KDBS | PostgreSQL | |
|---|---|---|
| Version | engine 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 |
| Settings | defaults, plus buffer_pool_frames = 65536; cores = 1 and durability = group unless stated | defaults: shared_buffers = 128MB, synchronous_commit = on, fsync = on |
| Durable at the reply | yes | yes |
| Data | a fresh data file per cell, on ext4 | one cluster on the same ext4 device |
| Client | Python driver over the KWP wire protocol | Python 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:
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:
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:
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:
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
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
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:
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
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
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
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
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:
| Statement | KDBS p50 | KDBS p99 | PostgreSQL p50 | PostgreSQL p99 |
|---|---|---|---|---|
| INSERT, 200 rows per transaction | 45.8 µs | 83.9 µs | 67.4 µs | 118.3 µs |
| INSERT inside a transaction, 7 columns | 63.9 µs | 104.4 µs | 81.0 µs | 127.2 µs |
| UPDATE by primary key, one column | 51.9 µs | 96.5 µs | 69.5 µs | 110.2 µs |
| COMMIT, durable | 1,209.8 µs | 2,121.9 µs | 1,278.8 µs | 2,650.1 µs |
| Primary-key read, 4,000-row table | 88.0 µs | 133.9 µs | 78.4 µs | 117.2 µs |
| Key range, 200 rows | 781.4 µs | 811.7 µs | 721.7 µs | 759.0 µs |
| Date-range filter, 10,000 loans | 1,108.4 µs | 1,181.4 µs | 933.3 µs | 1,284.3 µs |
| Correlated EXISTS, no index | 621.4 µs | 673.2 µs | 1,303.1 µs | 1,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:
| Cost | KDBS | PostgreSQL | KDBS / PG time |
|---|---|---|---|
| Fixed round trip, 252-row table | 74.4 µs | 99.8 µs | 0.75x |
| Fixed round trip, 60,480-row table | 79.1 µs | 68.0 µs | 1.16x |
| Each examined, unreturned row | about 26 ns | about 39 ns | 0.67x |
| Each returned row, 9-column key range | 3.57 µs | 3.23 µs | 1.11x |
| Each inserted row, commit amortised (1,000 per transaction) | 47.9 µs | 60.6 µs | 0.79x |
| One durable commit | 1,254 µs | 1,292 µs | 0.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.