Cassandra vs PostgreSQL benchmarks: one node, two ideas of where the work goes

Databases

PostgreSQL and Cassandra are both called databases, but they put the work in different places. PostgreSQL keeps each table as a heap of 8 KB pages with B-tree indexes beside it, and changes a row on its page: to overwrite a row it has to have that page in memory, writes a new row version beside the old one and logs the change to its write-ahead log (WAL). Cassandra is a log-structured merge tree: a write goes to a commit log and an in-memory table (the memtable) and is acknowledged without reading anything; the memtable is later flushed to immutable sorted files (SSTables) that compaction merges in the background, and a read has to look in the memtable and in every SSTable that might hold the row. PostgreSQL answers any SQL over the whole table on one primary; Cassandra answers queries by partition key, and spreads partitions over as many nodes as you add.

So the question is less “which is faster” than “which work does each make cheap”. This benchmark puts both on one machine, single node each, on the same 4 cores, the same memory limit and the same disk, and measures each kind of work. Every value is derived from its key, and every value read back is compared byte for byte with what was written: 4,392,189,507 rows (point reads, slice rows, reads in the mixed test, rows read back after kill -9), 0 mismatches. On top of the 1,000,000,000 bulk-loaded rows, the tests wrote 408,476,297 rows.

SetupDetails
DatabasesPostgreSQL 18.6 · Cassandra 5.0.9 (OpenJDK 17, G1) · official images pinned by digest, one database running at a time, single node, no replication
DataTime-series readings: (device bigint, ts bigint, v blob), primary key (device, ts); in Cassandra device is the partition key and ts the clustering column, newest first (CLUSTERING ORDER BY (ts DESC)). 100-byte values: 16 bytes repeat the key, 84 bytes come from a pseudo-random stream seeded by the key, so no two rows share filler and compression can only shrink the key bytes
Two scalesIn memory: 10 M rows (20,000 devices × 500 readings), 16 GB memory limit: PostgreSQL’s table and index take 1.8 GB, Cassandra’s 0.96 GB · larger than memory: 40 M rows (100,000 × 400), 4 GB limit: PostgreSQL 7.2 GB against 1 GB of shared buffers and what is left of the 4 GB for the page cache; Cassandra 3.9 GB against the 2 GB left after its 2 GB heap. Every data file is dropped from the page cache before the first read
SettingsDefaults, except memory: PostgreSQL shared_buffers at 25 % of the limit (4 GB / 1 GB; the default is 128 MB) and max_connections=300; Cassandra’s heap at what its own cassandra-env.sh picks for a machine with that much memory (8 GB / 2 GB; the script reads the host’s RAM, not the container’s limit, so it has to be set). Cassandra runs the image’s backward-compatible cassandra.yaml: size-tiered compaction (STCS), the BIG SSTable format, LZ4, commitlog_sync: periodic every 10 s; the cassandra_latest.yaml that Cassandra 5 recommends for new clusters (unified compaction, trie-indexed SSTables) was not tested. PostgreSQL: synchronous_commit=on, max_wal_size 1 GB, checkpoint_timeout 5 min
ClientsOne Go 1.26 program: pgx 5.12, one pooled connection per request in flight (256 in the mixed test) · Apache Cassandra Go driver 2.1.2, token-aware (each request goes straight to the node that owns its partition), consistency ONE, 2 connections (the driver’s default; each carries thousands of requests at once), its write coalescing switched off: its default 200 µs wait held every request about 1.1 ms on this machine. That is the one setting changed on a client; PostgreSQL’s side needed none · every statement prepared · every write an upsert: Cassandra’s INSERT always is one, PostgreSQL’s is INSERT … ON CONFLICT DO UPDATE
CPUAMD Ryzen AI Max+ 395 · cores 0–7 and their SMT siblings reserved for the benchmark (system services and movable IRQs moved to the other CCD) · database on cores 0–3 (4 cores, 8 threads), client on cores 4–7 · CPU time of each side recorded for every test
StorageOne directory on an NVMe SSD (ext4), emptied before every server start, shared with other workloads on this machine · between groups of tests the database is settled, and the time it takes is recorded as deferred work: PostgreSQL VACUUM ANALYZE and CHECKPOINT; Cassandra nodetool flush and no pending compactions
MethodEvery value is 10 runs, each a fresh client process, each on a freshly loaded server · reported value: median of the runs (mean of the two middle ones), with min–max · latency percentiles per run, then the median across runs · for every test, PostgreSQL’s “checkpoints are occurring too frequently” warnings and Cassandra’s garbage-collection pauses are counted

Which one is for what

PostgreSQLCassandra
Data modelTables, any number of indexes, joins, constraints, SQLTables queried by partition key; rows within a partition sorted by clustering columns; one table per query pattern
A writeNeeds the row’s page in memory (reads it if it is not cached), writes a new row version, logs it to the WALAppends to the commit log and the memtable; never reads
A readOne index lookup, one heap pageThe memtable and every SSTable whose Bloom filter (a compact “might contain” index) says it might hold the partition
TransactionsACID across any rows and tablesAtomic per partition; lightweight transactions (Paxos) for compare-and-set
Scaling outOne primary takes the writes; replicas for reads; sharding is extra softwareAdd nodes: partitions spread by token, every node takes writes, replication factor and consistency per query
When a node failsFailover to a replicaNothing to fail over: other replicas answer

The first four rows are what this benchmark measures on one node. The last two are why Cassandra exists, and a single node does not show them; they are the subject of ten ways to scale a database.

The scoreboard

How many times better the leader is on each measure: Point read · in memory: PostgreSQL 3.2×; Point read · larger than memory: PostgreSQL 1.5×; Newest 100 readings · in memory: PostgreSQL 2.7×; Overwrite · in memory · both fsync first: PostgreSQL 1.4×; Overwrite · in memory · both fsync later: Cassandra 1.9×; Overwrite · larger than memory · both fsync first: Cassandra 1.9×; Overwrite · larger than memory · both fsync later: Cassandra 14.5×; New rows · both fsync first: PostgreSQL 3.9×; New rows · both fsync later: level; Bulk load + settle · in memory: PostgreSQL 2.8×; Bulk load + settle · larger than memory: PostgreSQL 2.3×; Window across all devices · in memory: PostgreSQL 6.1×; Window across all devices · larger than memory: Cassandra 1.7×; Disk per row, table · in memory: Cassandra 1.9×; Disk per row, table · larger than memory: Cassandra 1.9×; p99 at 30k ops/s, 50/50 · in memory · defaults: Cassandra 2.2×. One node, 4 cores: how many times better the leader is on each measure Log scale · overwrite and new-row rows pair equal durability settings · p99 row at each default 1× 10× 10× ← PostgreSQL better Cassandra better → Point read · in memory 3.2× Point read · larger than memory 1.5× Newest 100 readings · in memory 2.7× Overwrite · in memory · both fsync first 1.4× Overwrite · in memory · both fsync later 1.9× Overwrite · larger than memory · both fsync first 1.9× Overwrite · larger than memory · both fsync later 14.5× New rows · both fsync first 3.9× New rows · both fsync later 1.0× Bulk load + settle · in memory 2.8× Bulk load + settle · larger than memory 2.3× Window across all devices · in memory 6.1× Window across all devices · larger than memory 1.7× Disk per row, table · in memory 1.9× Disk per row, table · larger than memory 1.9× p99 at 30k ops/s, 50/50 · in memory · defaults 2.2× Rows are measures, not wins to count: several appear once per scale. Overwrites and new rows are compared at equal durability (both fsync before the acknowledgement, or both later). One node only.
Each bar: how many times better the leading database is, PostgreSQL to the left, Cassandra to the right, log scale. Throughputs at each database's best number of requests in flight; medians of 10 runs. One node each, 4 cores, the same disk.
How many times better the leader is on each measure: Point read · in memory: PostgreSQL 3.2×; Point read · larger than memory: PostgreSQL 1.5×; Newest 100 readings · in memory: PostgreSQL 2.7×; Overwrite · in memory · both fsync first: PostgreSQL 1.4×; Overwrite · in memory · both fsync later: Cassandra 1.9×; Overwrite · larger than memory · both fsync first: Cassandra 1.9×; Overwrite · larger than memory · both fsync later: Cassandra 14.5×; New rows · both fsync first: PostgreSQL 3.9×; New rows · both fsync later: level; Bulk load + settle · in memory: PostgreSQL 2.8×; Bulk load + settle · larger than memory: PostgreSQL 2.3×; Window across all devices · in memory: PostgreSQL 6.1×; Window across all devices · larger than memory: Cassandra 1.7×; Disk per row, table · in memory: Cassandra 1.9×; Disk per row, table · larger than memory: Cassandra 1.9×; p99 at 30k ops/s, 50/50 · in memory · defaults: Cassandra 2.2×. One node, 4 cores: how many times better the leader is on each measure Log scale · overwrite and new-row rows pair equal durability settings · p99 row at each default 1× 10× 10× ← PostgreSQL better Cassandra better → Point read · in memory 3.2× Point read · larger than memory 1.5× Newest 100 readings · in memory 2.7× Overwrite · in memory · both fsync first 1.4× Overwrite · in memory · both fsync later 1.9× Overwrite · larger than memory · both fsync first 1.9× Overwrite · larger than memory · both fsync later 14.5× New rows · both fsync first 3.9× New rows · both fsync later 1.0× Bulk load + settle · in memory 2.8× Bulk load + settle · larger than memory 2.3× Window across all devices · in memory 6.1× Window across all devices · larger than memory 1.7× Disk per row, table · in memory 1.9× Disk per row, table · larger than memory 1.9× p99 at 30k ops/s, 50/50 · in memory · defaults 2.2× Rows are measures, not wins to count: several appear once per scale. Overwrites and new rows are compared at equal durability (both fsync before the acknowledgement, or both later). One node only.
Each bar: how many times better the leading database is, PostgreSQL to the left, Cassandra to the right, log scale. Throughputs at each database's best number of requests in flight; medians of 10 runs. One node each, 4 cores, the same disk.
MeasurePostgreSQLCassandraLeader
Point read · in memory585k184kPostgreSQL, 3.2×
Point read · larger than memory133k91kPostgreSQL, 1.5×
Newest 100 readings · in memory139k52kPostgreSQL, 2.7×
Overwrite · in memory · both fsync first57k40kPostgreSQL, 1.4×
Overwrite · in memory · both fsync later231k446kCassandra, 1.9×
Overwrite · larger than memory · both fsync first21k39kCassandra, 1.9×
Overwrite · larger than memory · both fsync later26k385kCassandra, 14.5×
New rows · both fsync first157k40kPostgreSQL, 3.9×
New rows · both fsync later411k405klevel, within 5 %
Bulk load + settle · in memory1.53M545kPostgreSQL, 2.8×
Bulk load + settle · larger than memory1.44M615kPostgreSQL, 2.3×
Window across all devices · in memory147 ms890 msPostgreSQL, 6.1×
Window across all devices · larger than memory5.55 s3.33 sCassandra, 1.7×
Disk per row, table · in memory181 B96 BCassandra, 1.9×
Disk per row, table · larger than memory181 B97 BCassandra, 1.9×
p99 at 30k ops/s, 50/50 · in memory · defaults2.50 ms1.12 msCassandra, 2.2×

PostgreSQL leads on point read · in memory (3.2×); point read · larger than memory (1.5×); newest 100 readings · in memory (2.7×); overwrite · in memory · both fsync first (1.4×); new rows · both fsync first (3.9×); bulk load + settle · in memory (2.8×); bulk load + settle · larger than memory (2.3×); window across all devices · in memory (6.1×). Cassandra leads on overwrite · in memory · both fsync later (1.9×); overwrite · larger than memory · both fsync first (1.9×); overwrite · larger than memory · both fsync later (14.5×); window across all devices · larger than memory (1.7×); disk per row, table · in memory (1.9×); disk per row, table · larger than memory (1.9×); p99 at 30k ops/s, 50/50 · in memory · defaults (2.2×). Within 5 % of each other: new rows · both fsync later. The overwrite and new-row rows compare equal durability: both fsync before acknowledging, or both acknowledge first and fsync later. The defaults sit on opposite sides (PostgreSQL fsyncs first, Cassandra later), so a comparison at the defaults compares settings as much as databases; the 99th-percentile row is the one row at the defaults, because that is how each ships.

Reads: requests in flight decide the number

A closed loop keeps 16, 64 or 256 requests in flight: each sends the next request as soon as the previous answer arrives.

Operations per second by requests in flight: get in memory PostgreSQL 16: 585,497, 64: 493,953, 256: 337,097; get in memory Cassandra 16: 134,919, 64: 173,730, 256: 184,144; get larger than memory PostgreSQL 16: 95,296, 64: 133,115, 256: 117,292; get larger than memory Cassandra 16: 61,716, 64: 90,718, 256: 90,580; upd in memory PostgreSQL 16: 28,546, 64: 57,267, 256: 47,163; upd in memory Cassandra 16: 272,939, 64: 374,365, 256: 445,798; upd larger than memory PostgreSQL 16: 8,151, 64: 20,846, 256: 18,646; upd larger than memory Cassandra 16: 265,961, 64: 351,646, 256: 384,607. Point reads in memory: PostgreSQL 585k/s, Cassandra 184k/s. Overwrites larger than memory: Cassandra 385k/s, PostgreSQL 21k/s Operations per second · log scale · 16 / 64 / 256 requests in flight PostgreSQL 18 Cassandra 5.0 1k 10k 100k 1M ops/s Point read · in memory PostgreSQL · 16 in flight 585k PostgreSQL · 64 in flight 494k PostgreSQL · 256 in flight 337k Cassandra · 16 in flight 135k Cassandra · 64 in flight 174k Cassandra · 256 in flight 184k Point read · larger than memory PostgreSQL · 16 in flight 95k PostgreSQL · 64 in flight 133k PostgreSQL · 256 in flight 117k Cassandra · 16 in flight 62k Cassandra · 64 in flight 91k Cassandra · 256 in flight 91k Overwrite a random row · in memory PostgreSQL · 16 in flight 29k PostgreSQL · 64 in flight 57k PostgreSQL · 256 in flight 47k Cassandra · 16 in flight 273k Cassandra · 64 in flight 374k Cassandra · 256 in flight 446k Overwrite a random row · larger than memory PostgreSQL · 16 in flight 8.2k PostgreSQL · 64 in flight 21k PostgreSQL · 256 in flight 19k Cassandra · 16 in flight 266k Cassandra · 64 in flight 352k Cassandra · 256 in flight 385k PostgreSQL in memory reads 1.7× slower at 256 in flight than at 16. Overwrites here are at each default durability; the equal-durability pairs are in the scoreboard. Cassandra's overwrite rate falls 1.2× when the data no longer fits, PostgreSQL's 2.7×.
Closed loop: 16, 64 or 256 requests in flight, each a new one as soon as the previous answer arrives, for 8 s after 2 s of warm-up; operations per second, median of 10 runs. Log scale. Reads check every byte; overwrites write the same bytes again, so the checks stay valid.
Operations per second by requests in flight: get in memory PostgreSQL 16: 585,497, 64: 493,953, 256: 337,097; get in memory Cassandra 16: 134,919, 64: 173,730, 256: 184,144; get larger than memory PostgreSQL 16: 95,296, 64: 133,115, 256: 117,292; get larger than memory Cassandra 16: 61,716, 64: 90,718, 256: 90,580; upd in memory PostgreSQL 16: 28,546, 64: 57,267, 256: 47,163; upd in memory Cassandra 16: 272,939, 64: 374,365, 256: 445,798; upd larger than memory PostgreSQL 16: 8,151, 64: 20,846, 256: 18,646; upd larger than memory Cassandra 16: 265,961, 64: 351,646, 256: 384,607. Point reads in memory: PostgreSQL 585k/s, Cassandra 184k/s. Overwrites larger than memory: Cassandra 385k/s, PostgreSQL 21k/s Operations per second · log scale · 16 / 64 / 256 requests in flight PostgreSQL 18 Cassandra 5.0 1k 10k 100k 1M ops/s Point read · in memory PostgreSQL · 16 in flight 585k PostgreSQL · 64 in flight 494k PostgreSQL · 256 in flight 337k Cassandra · 16 in flight 135k Cassandra · 64 in flight 174k Cassandra · 256 in flight 184k Point read · larger than memory PostgreSQL · 16 in flight 95k PostgreSQL · 64 in flight 133k PostgreSQL · 256 in flight 117k Cassandra · 16 in flight 62k Cassandra · 64 in flight 91k Cassandra · 256 in flight 91k Overwrite a random row · in memory PostgreSQL · 16 in flight 29k PostgreSQL · 64 in flight 57k PostgreSQL · 256 in flight 47k Cassandra · 16 in flight 273k Cassandra · 64 in flight 374k Cassandra · 256 in flight 446k Overwrite a random row · larger than memory PostgreSQL · 16 in flight 8.2k PostgreSQL · 64 in flight 21k PostgreSQL · 256 in flight 19k Cassandra · 16 in flight 266k Cassandra · 64 in flight 352k Cassandra · 256 in flight 385k PostgreSQL in memory reads 1.7× slower at 256 in flight than at 16. Overwrites here are at each default durability; the equal-durability pairs are in the scoreboard. Cassandra's overwrite rate falls 1.2× when the data no longer fits, PostgreSQL's 2.7×.
Closed loop: 16, 64 or 256 requests in flight, each a new one as soon as the previous answer arrives, for 8 s after 2 s of warm-up; operations per second, median of 10 runs. Log scale. Reads check every byte; overwrites write the same bytes again, so the checks stay valid.
OperationScaleDatabase16 in flight64256
Point readin memoryPostgreSQL585k
568k–592k · p99 44 µs
494k
480k–502k · p99 241 µs
337k
327k–343k · p99 1.37 ms
Point readin memoryCassandra135k
132k–138k · p99 306 µs
174k
170k–177k · p99 1.33 ms
184k
178k–187k · p99 4.86 ms
Point readlarger than memoryPostgreSQL95k
11k–99k · p99 621 µs
133k
23k–145k · p99 1.51 ms
117k
12k–134k · p99 4.98 ms
Point readlarger than memoryCassandra62k
8.2k–65k · p99 836 µs
91k
64k–96k · p99 1.83 ms
91k
65k–97k · p99 4.58 ms
Overwritein memoryPostgreSQL29k
26k–29k · p99 896 µs
57k
12k–72k · p99 13.1 ms
47k
18k–90k · p99 46.3 ms
Overwritein memoryCassandra273k
227k–276k · p99 150 µs
374k
325k–381k · p99 468 µs
446k
366k–455k · p99 1.43 ms
Overwritelarger than memoryPostgreSQL8.2k
5.6k–16k · p99 30.1 ms
21k
2.8k–30k · p99 41.6 ms
19k
10k–39k · p99 88.2 ms
Overwritelarger than memoryCassandra266k
233k–274k · p99 154 µs
352k
249k–371k · p99 496 µs
385k
341k–403k · p99 2.65 ms

Overwrites: durability first, then whether the page is in memory

An overwrite of a random existing row is where the two designs differ most, and where durability decides most of the number. Each database was measured at both of its settings on the same loaded data: PostgreSQL with synchronous_commit on and off per session, Cassandra restarted with commitlog_sync: batch.

Best of 16 / 64 / 256 in flightIn memoryLarger than memory
PostgreSQL, fsync before the acknowledgement (default)57k21k
Cassandra, fsync before the acknowledgement (batch)40k39k
PostgreSQL, fsync later (synchronous_commit=off)231k26k
Cassandra, fsync later (default)446k385k

A fixed rate: latency, half reads and half overwrites

An open loop schedules operations at a fixed rate, half point reads and half overwrites, and measures each from its scheduled time, so a server that falls behind is charged for the queue it causes. Both run at their defaults. A run kept up if it finished no more than 0.5 s behind the schedule.

Latency at a fixed rate, 50 % reads and 50 % overwrites: in memory 10,000/s PostgreSQL p50 418 µs p99 1.55 ms; in memory 10,000/s Cassandra p50 540 µs p99 1.19 ms; in memory 30,000/s PostgreSQL p50 433 µs p99 2.50 ms; in memory 30,000/s Cassandra p50 100 µs p99 1.12 ms; in memory 60,000/s PostgreSQL p50 526 µs p99 326 ms; in memory 60,000/s Cassandra p50 92 µs p99 896 µs; larger than memory 10,000/s PostgreSQL p50 810 µs p99 3.67 ms; larger than memory 10,000/s Cassandra p50 360 µs p99 1.97 ms; larger than memory 30,000/s PostgreSQL p50 1,001 ms p99 4,592 ms; larger than memory 30,000/s Cassandra p50 162 µs p99 7.64 ms. At 30k operations a second in memory: median 433 µs (PostgreSQL) and 100 µs (Cassandra), 99th percentile 2.50 ms and 1.12 ms 50 % reads, 50 % overwrites · bar: median, tick: 99th percentile · log scale PostgreSQL 18 Cassandra 5.0 0.1 1 10 100 1,000 ms 10 M rows, 16 GB: fits in memory PostgreSQL · 10k/s 418 µs · p99 1.55 ms Cassandra · 10k/s 540 µs · p99 1.19 ms PostgreSQL · 30k/s 433 µs · p99 2.50 ms Cassandra · 30k/s 100 µs · p99 1.12 ms PostgreSQL · 60k/s 526 µs · p99 326 ms Cassandra · 60k/s 92 µs · p99 896 µs 40 M rows, 4 GB: larger than memory PostgreSQL · 10k/s 810 µs · p99 3.67 ms Cassandra · 10k/s 360 µs · p99 1.97 ms PostgreSQL · 30k/s fell behind the schedule in 7 of 10 runs Cassandra · 30k/s 162 µs · p99 7.64 ms Each at its default: a PostgreSQL overwrite is acknowledged after its WAL fsync, a Cassandra overwrite before its commit log is fsynced (every 10 s). Kept up: finished no more than 0.5 s behind the schedule.
Open loop: operations scheduled at a fixed rate for 10 s, half point reads and half overwrites of random rows; latency from the scheduled time, so a server that falls behind is charged for the queue. Bar: median; tick: 99th percentile; each the median of 10 runs. Log scale.
Latency at a fixed rate, 50 % reads and 50 % overwrites: in memory 10,000/s PostgreSQL p50 418 µs p99 1.55 ms; in memory 10,000/s Cassandra p50 540 µs p99 1.19 ms; in memory 30,000/s PostgreSQL p50 433 µs p99 2.50 ms; in memory 30,000/s Cassandra p50 100 µs p99 1.12 ms; in memory 60,000/s PostgreSQL p50 526 µs p99 326 ms; in memory 60,000/s Cassandra p50 92 µs p99 896 µs; larger than memory 10,000/s PostgreSQL p50 810 µs p99 3.67 ms; larger than memory 10,000/s Cassandra p50 360 µs p99 1.97 ms; larger than memory 30,000/s PostgreSQL p50 1,001 ms p99 4,592 ms; larger than memory 30,000/s Cassandra p50 162 µs p99 7.64 ms. At 30k operations a second in memory: median 433 µs (PostgreSQL) and 100 µs (Cassandra), 99th percentile 2.50 ms and 1.12 ms 50 % reads, 50 % overwrites · bar: median, tick: 99th percentile · log scale PostgreSQL 18 Cassandra 5.0 0.1 1 10 100 1,000 ms 10 M rows, 16 GB: fits in memory PostgreSQL · 10k/s 418 µs · p99 1.55 ms Cassandra · 10k/s 540 µs · p99 1.19 ms PostgreSQL · 30k/s 433 µs · p99 2.50 ms Cassandra · 30k/s 100 µs · p99 1.12 ms PostgreSQL · 60k/s 526 µs · p99 326 ms Cassandra · 60k/s 92 µs · p99 896 µs 40 M rows, 4 GB: larger than memory PostgreSQL · 10k/s 810 µs · p99 3.67 ms Cassandra · 10k/s 360 µs · p99 1.97 ms PostgreSQL · 30k/s fell behind the schedule in 7 of 10 runs Cassandra · 30k/s 162 µs · p99 7.64 ms Each at its default: a PostgreSQL overwrite is acknowledged after its WAL fsync, a Cassandra overwrite before its commit log is fsynced (every 10 s). Kept up: finished no more than 0.5 s behind the schedule.
Open loop: operations scheduled at a fixed rate for 10 s, half point reads and half overwrites of random rows; latency from the scheduled time, so a server that falls behind is charged for the queue. Bar: median; tick: 99th percentile; each the median of 10 runs. Log scale.
ScaleRateDatabasep50p99p99.9Kept up
in memory10,000/sPostgreSQL418 µs1.55 ms
1.53 ms–111 ms
7.66 ms10/10
in memory10,000/sCassandra540 µs1.19 ms
1.18 ms–12.8 ms
21.7 ms10/10
in memory30,000/sPostgreSQL433 µs2.50 ms
1.13 ms–20,044 ms
14.4 ms9/10
in memory30,000/sCassandra100 µs1.12 ms
1.08 ms–5.08 ms
17.6 ms10/10
in memory60,000/sPostgreSQL526 µs326 ms
19.8 ms–6,019 ms
356 ms8/10
in memory60,000/sCassandra92 µs896 µs
600 µs–10.1 ms
15.8 ms10/10
larger than memory10,000/sPostgreSQL810 µs3.67 ms
2.94 ms–398 ms
11.2 ms10/10
larger than memory10,000/sCassandra360 µs1.97 ms
1.72 ms–1,056 ms
12.4 ms10/10
larger than memory30,000/sPostgreSQL1,001 ms4,592 ms
15.7 ms–7,186 ms
4,736 ms3/10
larger than memory30,000/sCassandra162 µs7.64 ms
4.88 ms–13,635 ms
18.4 ms9/10

At 30,000 operations a second in memory the medians are 433 µs (PostgreSQL) and 100 µs (Cassandra), and the 99th percentiles 2.50 ms and 1.12 ms. PostgreSQL’s 99th percentile varies widely from run to run: 1.13 ms to 20,044 ms at 30k, 19.8 ms to 6,019 ms at 60k, where it kept up in 8 of 10 runs. It logged 125 forced-checkpoint warnings during the mixed tests of all runs; which of them caused which stall was not isolated. Cassandra’s p99 stayed between 1.08 ms and 5.08 ms at 30k; its longest garbage-collection pause during a 30k test was 24 ms (median across runs), and its 99.9th percentile there was 17.6 ms.

Durability: what each setting acknowledges

Both databases offer a setting that fsyncs before acknowledging and one that fsyncs later. Their defaults sit on opposite sides:

fsync before the acknowledgementfsync later, in the background
PostgreSQLsynchronous_commit=on · the default · commits waiting at the same moment share one WAL fsyncsynchronous_commit=off · the WAL writer flushes every wal_writer_delay (200 ms)
Cassandracommitlog_sync: batch · fsync, then acknowledgecommitlog_sync: periodic · the default · fsync every 10 s

New rows go into an empty table for 8 s at 64 and 256 in flight. Then, on a fresh server, rows are written at 10,000 a second, the server is killed with SIGKILL about a second in, restarted, and every acknowledged row is read back.

New rows per second into an empty table by durability setting, and acknowledged rows lost to kill -9: PostgreSQL, fsync at commit (default) 157,397/s, lost 0 of 105673; Cassandra, commit log batch (fsync first) 40,428/s, lost 0 of 100747; PostgreSQL, synchronous_commit off 410,726/s, lost 14876 of 106422; Cassandra, commit log periodic (default) 405,358/s, lost 6244 of 106323. Rows acknowledged and then lost to kill -9: synchronous_commit off 14,876, commitlog periodic 6,244. With an fsync before every acknowledgement: PostgreSQL 157k new rows/s, Cassandra 40k New rows per second, the better of 64 and 256 in flight · log scale · after the bar: acknowledged rows lost over all kills PostgreSQL 18 Cassandra 5.0 10k 100k 1M rows/s fsync before the acknowledgement PostgreSQL: fsync at commit · default 157k · lost 0 Cassandra: commit log batch (fsync first) 40k · lost 0 fsync later, in the background PostgreSQL: synchronous_commit off 411k · lost 14,876 Cassandra: commit log periodic · default 405k · lost 6,244 A process kill is not a power cut: the page cache survives it. What a setting loses here is what it had acknowledged while still holding it in the process's own memory.
New rows: 64 or 256 requests in flight into an empty table for 8 s, the better of the two; median of 10 runs. Lost: rows written at 10,000 a second, the server killed with SIGKILL about 1 s in, restarted, every acknowledged row read back; total over 10 kills. Log scale.
New rows per second into an empty table by durability setting, and acknowledged rows lost to kill -9: PostgreSQL, fsync at commit (default) 157,397/s, lost 0 of 105673; Cassandra, commit log batch (fsync first) 40,428/s, lost 0 of 100747; PostgreSQL, synchronous_commit off 410,726/s, lost 14876 of 106422; Cassandra, commit log periodic (default) 405,358/s, lost 6244 of 106323. Rows acknowledged and then lost to kill -9: synchronous_commit off 14,876, commitlog periodic 6,244. With an fsync before every acknowledgement: PostgreSQL 157k new rows/s, Cassandra 40k New rows per second, the better of 64 and 256 in flight · log scale · after the bar: acknowledged rows lost over all kills PostgreSQL 18 Cassandra 5.0 10k 100k 1M rows/s fsync before the acknowledgement PostgreSQL: fsync at commit · default 157k · lost 0 Cassandra: commit log batch (fsync first) 40k · lost 0 fsync later, in the background PostgreSQL: synchronous_commit off 411k · lost 14,876 Cassandra: commit log periodic · default 405k · lost 6,244 A process kill is not a power cut: the page cache survives it. What a setting loses here is what it had acknowledged while still holding it in the process's own memory.
New rows: 64 or 256 requests in flight into an empty table for 8 s, the better of the two; median of 10 runs. Lost: rows written at 10,000 a second, the server killed with SIGKILL about 1 s in, restarted, every acknowledged row read back; total over 10 kills. Log scale.
SettingNew rows/s, 64 in flight256 in flightAcked rows lost to kill -9Kills with a lossLost per kill
PostgreSQL, fsync at commit (default)126k
13k–127k
157k
151k–167k
0 of 105,6730/100–0 (median 0)
Cassandra, commit log batch (fsync first)40k
31k–42k
40k
26k–41k
0 of 100,7470/100–0 (median 0)
PostgreSQL, synchronous_commit off411k
381k–415k
305k
288k–318k
14,876 of 106,42210/10128–2,090 (median 1,575)
Cassandra, commit log periodic (default)405k
353k–417k
405k
389k–435k
6,244 of 106,32310/1072–911 (median 746)

Bulk load, disk and a query across every partition

ScaleDatabaseBulk load, rows/sLoad + settle, rows/sDisk per row, tableAll filesWindow queryPostgreSQL, 8 workersOne server-side statement
in memoryPostgreSQL2.54M
2.47M–2.70M
1.53M181 B290 B223 ms
208 ms–229 ms
147 ms311 ms
in memoryCassandra1.03M
753k–1.15M
545k96 B110 B890 ms
816 ms–1.06 s
–2.97 s
larger than memoryPostgreSQL1.54M
662k–2.48M
1.44M181 B208 B8.88 s
7.12 s–10.2 s
5.55 s17.4 s
larger than memoryCassandra1.24M
614k–1.48M
615k97 B104 B3.33 s
3.14 s–4.49 s
–failed

When to pick which

What the numbers say

What this does not show

Reproduce it

The harness is one Go program with both drivers and a few shell scripts that start the client container and one database per configuration:

docker build -t cpb .                          # Go 1.26 build, runs a self-test of the payload checks
./net.sh 4-7,20-23                             # client container, no network; the database joins its namespace
./db.sh cas-periodic 0-3,16-19 "" 16g          # empty data dir, Cassandra with the default commit log, 16 GB limit
docker exec cp-net cp ready -db cas
docker exec cp-net cp load -db cas -devs 20000 -per 500
./settle.sh cas                                # flush, wait for compactions
docker exec cp-net cp get -db cas -devs 20000 -per 500 -c 64 -dur 8s
docker exec cp-net cp mix -db cas -devs 20000 -per 500 -rate 30000 -dur 10s

Each test prints one JSON line: operations, errors, mismatched values, the rate, the latency percentiles and each side’s CPU time; run.sh runs the full matrix and figs/ turns results.jsonl into the figures and tables above.

Questions? Let's Chat :)

databases