Roc Solid
Markup in Roc · pages on a native server · components in WebAssembly

Examples · examples/sqlite-vs-turso

sqlite-vs-turso

One app timing the same database work on SQLite and Turso: writes alone and in a transaction, reads by key and by index, sums, JSON, a recursive query, eight callers at once (on their own rows, on one row, reading beside writing); a sale written to four tables in one transaction, with and without its job queued in it; then a million orders fetched one and a hundred at a time, and joined to their customers. Each is timed in Roc, in the server, around its Db calls. The results are on this page, except the sale's four workloads, not measured yet.

SourceREADMEAll the examples

What it shows#

The results#

Each workload is timed in Roc, in the server, around the Db calls it makes (Time.now_nanos! ), so no HTTP is in the numbers; the app built with --opt=speed as it would ship. Each engine keeps one file for the whole of it, as an app's database lives, written and read for a long time: after a small warm-up, the benchmark 10 times in a row. The buttons pick the first run, the first three or all of them, and the switch beside them leaves the first out of three or ten (runs 2–3, or 2–10), a cold start that may weigh on the rest; a cell gives their average, and under it the fastest and the slowest. Higher is better; a bar is a rate against its row's fastest, in bold.

First everyday work on 20,000 items, each run deleting the last run's and writing them again: what one caller does, then what eight do at once (eight actors told together, timed from the first told to the last done), then a checkpoint and the reads again.

Runs in a row
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
insert-eachan insert committed alone 52,361/s 19.1 µs 53,288/s 18.8 µs 58,734/s 17.0 µs
insert-batchan insert, all in one transaction 145,412/s 6.9 µs 72,887/s 13.7 µs 102,978/s 9.7 µs
read-pointa row read by its key 124,757/s 8.0 µs 140,596/s 7.1 µs 119,548/s 8.4 µs
read-range50 rows of a category, by its index 19,225/s 52.0 µs 10,431/s 95.9 µs 20,046/s 49.9 µs
aggregatea group by over the whole table 384/s 2.6 ms 46.3/s 21.6 ms 283/s 3.5 ms
update-eachan update committed alone 80,746/s 12.4 µs 60,074/s 16.6 µs 69,719/s 14.3 µs
jsona row's JSON read apart and put together 110,281/s 9.1 µs 71,303/s 14.0 µs 87,179/s 11.5 µs
recursivea recursive query counting to 10,000 1,609/s 621.2 µs 260/s 3.8 ms 255/s 3.9 ms
scana sum over every row, no index 2,879/s 347.2 µs 489/s 2.0 ms 2,688/s 371.9 µs
aggregate-no-indexthe group by, its index ruled out: a scan and a sort 556/s 1.8 ms 236/s 4.2 ms 461/s 2.2 ms
concurrent-insertan insert committed alone, eight writers at once 46,668/s 21.4 µs 83,522/s 12.0 µs 67,091/s 14.9 µs
concurrent-own-rowsa transaction on a counter of its own, eight at once 10,732/s 93.2 µs 35,976/s 27.8 µs 13,287/s 75.3 µs
concurrent-one-rowa transaction on one counter, eight at once 6,866/s 145.6 µs 16,635/s 60.1 µs · 834 runs 7,014/s 142.6 µs
concurrent-mixeda read or an insert, four readers and four writers at once 131,946/s 7.6 µs 139,201/s 7.2 µs 130,497/s 7.7 µs
checkpointa checkpoint: what the log holds, written into the database's pages 1,396/s 716.0 µs 17.2/s 58.0 ms 2,849/s 350.9 µs
read-point-checkpointeda row read by its key, after the checkpoint 123,308/s 8.1 µs 148,107/s 6.8 µs 125,916/s 7.9 µs
read-range-checkpointed50 rows of a category by its index, after the checkpoint 18,257/s 54.8 µs 14,902/s 67.1 µs 20,173/s 49.6 µs
aggregate-checkpointedthe group by, after the checkpoint 388/s 2.6 ms 117/s 8.5 ms 278/s 3.6 ms
scan-checkpointeda sum over every row, after the checkpoint 2,903/s 344.4 µs 573/s 1.7 ms 2,719/s 367.7 µs
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
insert-eachan insert committed alone 51,697/s 19.3 µs 18.8–20.1 µs35,952/s 27.8 µs 18.8–43.8 µs59,494/s 16.8 µs 16.0–17.4 µs
insert-batchan insert, all in one transaction 138,840/s 7.2 µs 6.9–7.4 µs71,458/s 14.0 µs 13.7–14.2 µs109,463/s 9.1 µs 7.8–9.9 µs
read-pointa row read by its key 124,046/s 8.1 µs 8.0–8.2 µs112,312/s 8.9 µs 7.1–9.9 µs128,581/s 7.8 µs 6.4–8.5 µs
read-range50 rows of a category, by its index 18,478/s 54.1 µs 52.0–55.4 µs10,613/s 94.2 µs 93.3–95.9 µs20,026/s 49.9 µs 49.9–50.0 µs
aggregatea group by over the whole table 383/s 2.6 ms 2.6–2.6 ms46.7/s 21.4 ms 21.2–21.6 ms282/s 3.5 ms 3.5–3.6 ms
update-eachan update committed alone 80,490/s 12.4 µs 12.3–12.6 µs53,701/s 18.6 µs 16.6–20.1 µs74,031/s 13.5 µs 12.9–14.3 µs
jsona row's JSON read apart and put together 122,108/s 8.2 µs 6.5–9.1 µs77,063/s 13.0 µs 11.2–14.0 µs89,097/s 11.2 µs 11.0–11.5 µs
recursivea recursive query counting to 10,000 1,586/s 630.4 µs 621.2–644.3 µs257/s 3.9 ms 3.8–4.0 ms252/s 4.0 ms 3.9–4.0 ms
scana sum over every row, no index 2,873/s 348.0 µs 347.2–349.6 µs477/s 2.1 ms 2.0–2.1 ms2,633/s 379.7 µs 371.9–390.8 µs
aggregate-no-indexthe group by, its index ruled out: a scan and a sort 561/s 1.8 ms 1.8–1.8 ms235/s 4.2 ms 4.2–4.3 ms455/s 2.2 ms 2.2–2.2 ms
concurrent-insertan insert committed alone, eight writers at once 45,801/s 21.8 µs 21.4–22.3 µs84,038/s 11.9 µs 11.3–12.4 µs55,389/s 18.1 µs 14.9–19.9 µs
concurrent-own-rowsa transaction on a counter of its own, eight at once 12,695/s 78.8 µs 70.4–93.2 µs36,713/s 27.2 µs 25.6–28.3 µs11,972/s 83.5 µs 75.3–89.9 µs
concurrent-one-rowa transaction on one counter, eight at once 6,339/s 157.7 µs 133.6–194.0 µs11,364/s 88.0 µs · 835 runs 60.1–121.0 µs7,089/s 141.0 µs 138.1–142.6 µs
concurrent-mixeda read or an insert, four readers and four writers at once 135,549/s 7.4 µs 7.0–7.6 µs144,789/s 6.9 µs 6.7–7.2 µs140,009/s 7.1 µs 6.7–7.7 µs
checkpointa checkpoint: what the log holds, written into the database's pages 1,277/s 782.7 µs 716.0–900.6 µs17.6/s 56.8 ms 55.9–58.0 ms2,661/s 375.8 µs 350.9–405.3 µs
read-point-checkpointeda row read by its key, after the checkpoint 123,104/s 8.1 µs 8.1–8.1 µs132,366/s 7.6 µs 6.8–9.0 µs121,290/s 8.2 µs 7.9–8.4 µs
read-range-checkpointed50 rows of a category by its index, after the checkpoint 18,229/s 54.9 µs 54.8–54.9 µs14,881/s 67.2 µs 67.1–67.2 µs20,138/s 49.7 µs 49.6–49.7 µs
aggregate-checkpointedthe group by, after the checkpoint 388/s 2.6 ms 2.6–2.6 ms114/s 8.7 ms 8.5–9.0 ms281/s 3.6 ms 3.5–3.6 ms
scan-checkpointeda sum over every row, after the checkpoint 2,889/s 346.1 µs 344.4–348.0 µs558/s 1.8 ms 1.7–1.8 ms2,725/s 366.9 µs 366.1–367.7 µs
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
insert-eachan insert committed alone 49,693/s 20.1 µs 18.8–24.4 µs43,174/s 23.2 µs 18.8–43.8 µs59,649/s 16.8 µs 16.0–17.4 µs
insert-batchan insert, all in one transaction 137,797/s 7.3 µs 6.8–7.6 µs71,041/s 14.1 µs 13.7–14.3 µs105,328/s 9.5 µs 7.8–10.2 µs
read-pointa row read by its key 123,332/s 8.1 µs 8.0–8.2 µs112,908/s 8.9 µs 6.9–10.0 µs123,483/s 8.1 µs 6.4–8.5 µs
read-range50 rows of a category, by its index 18,248/s 54.8 µs 52.0–56.0 µs10,548/s 94.8 µs 93.3–99.5 µs19,612/s 51.0 µs 45.8–63.0 µs
aggregatea group by over the whole table 385/s 2.6 ms 2.6–2.7 ms46.3/s 21.6 ms 21.2–22.6 ms279/s 3.6 ms 3.5–3.6 ms
update-eachan update committed alone 78,921/s 12.7 µs 12.3–14.3 µs52,116/s 19.2 µs 16.6–20.1 µs71,630/s 14.0 µs 12.9–15.1 µs
jsona row's JSON read apart and put together 115,154/s 8.7 µs 6.5–9.1 µs73,283/s 13.6 µs 11.2–14.2 µs88,855/s 11.3 µs 10.8–11.6 µs
recursivea recursive query counting to 10,000 1,594/s 627.1 µs 617.1–644.3 µs251/s 4.0 ms 3.7–5.2 ms255/s 3.9 ms 3.8–4.0 ms
scana sum over every row, no index 2,881/s 347.0 µs 343.4–349.6 µs471/s 2.1 ms 2.0–2.3 ms2,635/s 379.4 µs 364.1–390.8 µs
aggregate-no-indexthe group by, its index ruled out: a scan and a sort 561/s 1.8 ms 1.8–1.8 ms228/s 4.4 ms 4.2–4.6 ms443/s 2.3 ms 2.1–3.0 ms
concurrent-insertan insert committed alone, eight writers at once 45,125/s 22.2 µs 17.4–29.9 µs94,676/s 10.6 µs 8.8–12.4 µs52,620/s 19.0 µs 14.1–21.0 µs
concurrent-own-rowsa transaction on a counter of its own, eight at once 13,119/s 76.2 µs 64.1–94.3 µs37,752/s 26.5 µs 25.2–28.3 µs13,364/s 74.8 µs 56.5–93.9 µs
concurrent-one-rowa transaction on one counter, eight at once 7,330/s 136.4 µs 65.7–194.0 µs11,381/s 87.9 µs · 836 runs 60.1–121.0 µs8,987/s 111.3 µs 56.4–142.6 µs
concurrent-mixeda read or an insert, four readers and four writers at once 136,045/s 7.4 µs 6.6–7.8 µs150,923/s 6.6 µs 5.6–7.2 µs145,123/s 6.9 µs 6.0–7.8 µs
checkpointa checkpoint: what the log holds, written into the database's pages 1,307/s 764.6 µs 644.7–900.6 µs17.6/s 56.7 ms 55.1–58.0 ms2,598/s 384.8 µs 345.3–471.7 µs
read-point-checkpointeda row read by its key, after the checkpoint 122,975/s 8.1 µs 7.6–9.2 µs121,081/s 8.3 µs 6.4–9.2 µs120,821/s 8.3 µs 7.7–8.5 µs
read-range-checkpointed50 rows of a category by its index, after the checkpoint 18,184/s 55.0 µs 54.4–56.7 µs14,829/s 67.4 µs 65.8–68.3 µs20,026/s 49.9 µs 49.6–50.4 µs
aggregate-checkpointedthe group by, after the checkpoint 387/s 2.6 ms 2.6–2.7 ms115/s 8.7 ms 8.5–9.0 ms281/s 3.6 ms 3.5–3.6 ms
scan-checkpointeda sum over every row, after the checkpoint 2,890/s 346.0 µs 342.3–354.6 µs545/s 1.8 ms 1.7–1.9 ms2,724/s 367.1 µs 362.3–376.5 µs
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
insert-eachan insert committed alone 51,371/s 19.5 µs 18.8–20.1 µs30,922/s 32.3 µs 20.8–43.8 µs59,881/s 16.7 µs 16.0–17.4 µs
insert-batchan insert, all in one transaction 135,771/s 7.4 µs 7.4–7.4 µs70,765/s 14.1 µs 14.1–14.2 µs113,022/s 8.8 µs 7.8–9.9 µs
read-pointa row read by its key 123,693/s 8.1 µs 8.0–8.2 µs102,047/s 9.8 µs 9.7–9.9 µs133,630/s 7.5 µs 6.4–8.5 µs
read-range50 rows of a category, by its index 18,126/s 55.2 µs 55.0–55.4 µs10,706/s 93.4 µs 93.3–93.5 µs20,016/s 50.0 µs 50.0–50.0 µs
aggregatea group by over the whole table 383/s 2.6 ms 2.6–2.6 ms46.9/s 21.3 ms 21.2–21.4 ms282/s 3.5 ms 3.5–3.6 ms
update-eachan update committed alone 80,363/s 12.4 µs 12.3–12.6 µs50,995/s 19.6 µs 19.1–20.1 µs76,393/s 13.1 µs 12.9–13.2 µs
jsona row's JSON read apart and put together 129,027/s 7.8 µs 6.5–9.0 µs80,307/s 12.5 µs 11.2–13.8 µs90,088/s 11.1 µs 11.0–11.2 µs
recursivea recursive query counting to 10,000 1,574/s 635.1 µs 625.9–644.3 µs255/s 3.9 ms 3.8–4.0 ms251/s 4.0 ms 3.9–4.0 ms
scana sum over every row, no index 2,869/s 348.4 µs 347.3–349.6 µs472/s 2.1 ms 2.1–2.1 ms2,607/s 383.5 µs 376.2–390.8 µs
aggregate-no-indexthe group by, its index ruled out: a scan and a sort 564/s 1.8 ms 1.8–1.8 ms235/s 4.3 ms 4.2–4.3 ms453/s 2.2 ms 2.2–2.2 ms
concurrent-insertan insert committed alone, eight writers at once 45,379/s 22.0 µs 21.8–22.3 µs84,298/s 11.9 µs 11.3–12.4 µs50,946/s 19.6 µs 19.4–19.9 µs
concurrent-own-rowsa transaction on a counter of its own, eight at once 13,972/s 71.6 µs 70.4–72.7 µs37,094/s 27.0 µs 25.6–28.3 µs11,407/s 87.7 µs 85.5–89.9 µs
concurrent-one-rowa transaction on one counter, eight at once 6,105/s 163.8 µs 133.6–194.0 µs9,810/s 101.9 µs · 836 runs 82.8–121.0 µs7,127/s 140.3 µs 138.1–142.5 µs
concurrent-mixeda read or an insert, four readers and four writers at once 137,425/s 7.3 µs 7.0–7.6 µs147,754/s 6.8 µs 6.7–6.8 µs145,305/s 6.9 µs 6.7–7.0 µs
checkpointa checkpoint: what the log holds, written into the database's pages 1,225/s 816.1 µs 731.6–900.6 µs17.8/s 56.2 ms 55.9–56.5 ms2,576/s 388.2 µs 371.1–405.3 µs
read-point-checkpointeda row read by its key, after the checkpoint 123,003/s 8.1 µs 8.1–8.1 µs125,686/s 8.0 µs 6.9–9.0 µs119,102/s 8.4 µs 8.3–8.4 µs
read-range-checkpointed50 rows of a category by its index, after the checkpoint 18,215/s 54.9 µs 54.9–54.9 µs14,871/s 67.2 µs 67.2–67.2 µs20,121/s 49.7 µs 49.7–49.7 µs
aggregate-checkpointedthe group by, after the checkpoint 387/s 2.6 ms 2.6–2.6 ms113/s 8.8 ms 8.6–9.0 ms283/s 3.5 ms 3.5–3.6 ms
scan-checkpointeda sum over every row, after the checkpoint 2,882/s 346.9 µs 345.9–348.0 µs551/s 1.8 ms 1.8–1.8 ms2,728/s 366.5 µs 366.1–366.8 µs
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
insert-eachan insert committed alone 49,413/s 20.2 µs 18.8–24.4 µs42,283/s 23.7 µs 19.4–43.8 µs59,753/s 16.7 µs 16.0–17.4 µs
insert-batchan insert, all in one transaction 137,000/s 7.3 µs 6.8–7.6 µs70,842/s 14.1 µs 13.9–14.3 µs105,596/s 9.5 µs 7.8–10.2 µs
read-pointa row read by its key 123,176/s 8.1 µs 8.0–8.2 µs110,490/s 9.1 µs 6.9–10.0 µs123,936/s 8.1 µs 6.4–8.5 µs
read-range50 rows of a category, by its index 18,146/s 55.1 µs 54.2–56.0 µs10,561/s 94.7 µs 93.3–99.5 µs19,565/s 51.1 µs 45.8–63.0 µs
aggregatea group by over the whole table 385/s 2.6 ms 2.6–2.7 ms46.3/s 21.6 ms 21.2–22.6 ms279/s 3.6 ms 3.5–3.6 ms
update-eachan update committed alone 78,724/s 12.7 µs 12.3–14.3 µs51,360/s 19.5 µs 18.8–20.1 µs71,849/s 13.9 µs 12.9–15.1 µs
jsona row's JSON read apart and put together 115,722/s 8.6 µs 6.5–9.1 µs73,510/s 13.6 µs 11.2–14.2 µs89,045/s 11.2 µs 10.8–11.6 µs
recursivea recursive query counting to 10,000 1,593/s 627.7 µs 617.1–644.3 µs250/s 4.0 ms 3.7–5.2 ms255/s 3.9 ms 3.8–4.0 ms
scana sum over every row, no index 2,882/s 347.0 µs 343.4–349.6 µs469/s 2.1 ms 2.0–2.3 ms2,630/s 380.2 µs 364.1–390.8 µs
aggregate-no-indexthe group by, its index ruled out: a scan and a sort 561/s 1.8 ms 1.8–1.8 ms227/s 4.4 ms 4.2–4.6 ms441/s 2.3 ms 2.1–3.0 ms
concurrent-insertan insert committed alone, eight writers at once 44,960/s 22.2 µs 17.4–29.9 µs96,102/s 10.4 µs 8.8–12.4 µs51,389/s 19.5 µs 14.1–21.0 µs
concurrent-own-rowsa transaction on a counter of its own, eight at once 13,451/s 74.3 µs 64.1–94.3 µs37,960/s 26.3 µs 25.2–28.3 µs13,372/s 74.8 µs 56.5–93.9 µs
concurrent-one-rowa transaction on one counter, eight at once 7,386/s 135.4 µs 65.7–194.0 µs10,995/s 90.9 µs · 837 runs 69.6–121.0 µs9,277/s 107.8 µs 56.4–142.5 µs
concurrent-mixeda read or an insert, four readers and four writers at once 136,516/s 7.3 µs 6.6–7.8 µs152,349/s 6.6 µs 5.6–7.1 µs146,953/s 6.8 µs 6.0–7.8 µs
checkpointa checkpoint: what the log holds, written into the database's pages 1,298/s 770.0 µs 644.7–900.6 µs17.7/s 56.5 ms 55.1–57.5 ms2,573/s 388.6 µs 345.3–471.7 µs
read-point-checkpointeda row read by its key, after the checkpoint 122,939/s 8.1 µs 7.6–9.2 µs118,675/s 8.4 µs 6.4–9.2 µs120,280/s 8.3 µs 7.7–8.5 µs
read-range-checkpointed50 rows of a category by its index, after the checkpoint 18,175/s 55.0 µs 54.4–56.7 µs14,821/s 67.5 µs 65.8–68.3 µs20,010/s 50.0 µs 49.7–50.4 µs
aggregate-checkpointedthe group by, after the checkpoint 387/s 2.6 ms 2.6–2.7 ms115/s 8.7 ms 8.5–9.0 ms281/s 3.6 ms 3.5–3.6 ms
scan-checkpointeda sum over every row, after the checkpoint 2,888/s 346.2 µs 342.3–354.6 µs542/s 1.8 ms 1.8–1.9 ms2,724/s 367.0 µs 362.3–376.5 µs

Where eight write one counter at once, Turso's transactions (MVCC) lose to each other and run again: the runs say how many it took them, where SQLite's take turns and run once each.

Why Turso's MVCC reads slower. A row it has written stays in its store of versions, in memory, apart from the database's pages, until a checkpoint writes it there (Turso checkpoints when its log reaches about 4 MB). Reading such a row is a lookup in that store and a check of which version the reader may see. A scan through the store costs several times a scan of the pages ( scan ); walking an index and reading each row it names costs far more, and that is how every engine answers the group by: it walks the category index, to save a sort, and reads each row for its price ( aggregate ). With the index ruled out the same group by is a scan and a sort ( aggregate-no-index ); after the checkpoint the rows are in the pages, and the gap narrows (the -checkpointed rows). It doesn't close: MVCC checks every row it reads against its store, even a row in the pages, as the million rows below show; and what earlier runs wrote, kept as versions, slows later ones. The recursive query is slow on both of Turso's modes: that is Turso's engine, not its MVCC.

A million rows#

1,000,000 orders of 10,000 customers, a hundred each, spread over the table, with an index on whose they are: loaded by SQL itself from a count (a recursive query, 100,000 rows to a statement, each its own transaction), then checkpointed, so the reads find them in the database's pages, as an app's older data is (Turso's MVCC has checkpointed as it loaded: its log fills many times over). Then orders fetched one at a time and a hundred at a time (by a range of keys, and by the index), joined to their customers, and summed: the ten customers who spent most, and a sum over every order. 10 runs in a row, each making its tables afresh and loading them again, on a file of its own apart from the everyday run's: on Turso's MVCC what that run wrote would slow these reads, though it never touched these tables.

Runs in a row
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
loada row inserted, the customers then the orders, 100,000 to a statement 355,846/s 2.8 µs 92,952/s 10.8 µs 395,530/s 2.5 µs
load-checkpointa checkpoint after the load 5,273/s 189.6 µs 8,531/s 117.2 µs 430/s 2.3 ms
fetch-1an order by its key 93,374/s 10.7 µs 50,371/s 19.9 µs 94,145/s 10.6 µs
fetch-100100 orders by a range of keys 9,817/s 101.9 µs 9,130/s 109.5 µs 9,964/s 100.4 µs
fetch-100-by-indexa customer's 100 orders, by an index 12,765/s 78.3 µs 5,583/s 179.1 µs 7,366/s 135.7 µs
join-1an order with its customer 52,166/s 19.2 µs 66,104/s 15.1 µs 81,882/s 12.2 µs
join-100a customer with their 100 orders 10,534/s 94.9 µs 5,164/s 193.6 µs 6,946/s 144.0 µs
join-top-10the ten customers who spent most: a join, a group by, a sort, over every order 1.4/s 719.4 ms 1.9/s 532.0 ms 2.8/s 353.0 ms
scan-ordersa sum over every order 54.4/s 18.4 ms 12.0/s 83.6 ms 48.2/s 20.7 ms
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
loada row inserted, the customers then the orders, 100,000 to a statement 355,428/s 2.8 µs 2.8–2.8 µs92,722/s 10.8 µs 10.8–10.8 µs392,942/s 2.5 µs 2.5–2.6 µs
load-checkpointa checkpoint after the load 5,066/s 197.4 µs 189.6–206.0 µs4,784/s 209.0 µs 117.2–280.2 µs187/s 5.3 ms 2.2–11.6 ms
fetch-1an order by its key 92,921/s 10.8 µs 10.5–11.0 µs50,694/s 19.7 µs 19.4–19.9 µs90,127/s 11.1 µs 10.6–11.5 µs
fetch-100100 orders by a range of keys 9,786/s 102.2 µs 101.9–102.6 µs9,148/s 109.3 µs 109.1–109.5 µs10,005/s 99.9 µs 99.2–100.4 µs
fetch-100-by-indexa customer's 100 orders, by an index 12,699/s 78.7 µs 78.3–79.2 µs5,571/s 179.5 µs 179.1–180.0 µs7,435/s 134.5 µs 133.8–135.7 µs
join-1an order with its customer 51,458/s 19.4 µs 19.2–19.6 µs66,129/s 15.1 µs 15.1–15.1 µs77,161/s 13.0 µs 12.2–13.4 µs
join-100a customer with their 100 orders 10,511/s 95.1 µs 94.2–96.3 µs5,156/s 193.9 µs 193.6–194.3 µs5,936/s 168.4 µs 142.8–218.6 µs
join-top-10the ten customers who spent most: a join, a group by, a sort, over every order 1.4/s 722.4 ms 719.4–724.6 ms1.9/s 529.8 ms 527.4–532.0 ms2.8/s 361.3 ms 353.0–375.2 ms
scan-ordersa sum over every order 53.1/s 18.8 ms 18.4–19.1 ms12.1/s 82.6 ms 81.5–83.6 ms47.1/s 21.2 ms 20.7–21.5 ms
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
loada row inserted, the customers then the orders, 100,000 to a statement 353,777/s 2.8 µs 2.8–2.9 µs91,629/s 10.9 µs 10.8–11.1 µs387,628/s 2.6 µs 2.5–2.6 µs
load-checkpointa checkpoint after the load 4,874/s 205.1 µs 188.3–238.4 µs6,180/s 161.8 µs 71.7–280.2 µs147/s 6.8 ms 2.1–14.6 ms
fetch-1an order by its key 95,202/s 10.5 µs 10.0–11.0 µs51,629/s 19.4 µs 18.2–19.9 µs91,478/s 10.9 µs 10.0–11.5 µs
fetch-100100 orders by a range of keys 9,780/s 102.2 µs 101.6–102.8 µs9,167/s 109.1 µs 107.9–110.0 µs10,075/s 99.3 µs 96.1–100.9 µs
fetch-100-by-indexa customer's 100 orders, by an index 12,704/s 78.7 µs 78.0–79.2 µs5,452/s 183.4 µs 179.1–187.6 µs7,303/s 136.9 µs 132.1–164.9 µs
join-1an order with its customer 50,935/s 19.6 µs 19.2–20.2 µs65,710/s 15.2 µs 15.1–15.4 µs77,477/s 12.9 µs 11.8–13.6 µs
join-100a customer with their 100 orders 10,528/s 95.0 µs 93.7–99.4 µs5,102/s 196.0 µs 187.0–223.3 µs6,683/s 149.6 µs 139.0–218.6 µs
join-top-10the ten customers who spent most: a join, a group by, a sort, over every order 1.4/s 713.5 ms 702.9–724.6 ms1.9/s 532.1 ms 526.7–540.4 ms2.8/s 357.9 ms 350.8–375.2 ms
scan-ordersa sum over every order 52.3/s 19.1 ms 18.4–19.6 ms11.9/s 83.9 ms 81.3–91.9 ms46.4/s 21.5 ms 20.7–22.4 ms
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
loada row inserted, the customers then the orders, 100,000 to a statement 355,219/s 2.8 µs 2.8–2.8 µs92,607/s 10.8 µs 10.8–10.8 µs391,660/s 2.6 µs 2.5–2.6 µs
load-checkpointa checkpoint after the load 4,969/s 201.2 µs 196.5–206.0 µs3,922/s 254.9 µs 229.7–280.2 µs145/s 6.9 ms 2.2–11.6 ms
fetch-1an order by its key 92,697/s 10.8 µs 10.5–11.0 µs50,857/s 19.7 µs 19.4–19.9 µs88,244/s 11.3 µs 11.2–11.5 µs
fetch-100100 orders by a range of keys 9,771/s 102.3 µs 102.1–102.6 µs9,157/s 109.2 µs 109.1–109.4 µs10,026/s 99.7 µs 99.2–100.3 µs
fetch-100-by-indexa customer's 100 orders, by an index 12,667/s 78.9 µs 78.7–79.2 µs5,565/s 179.7 µs 179.3–180.0 µs7,470/s 133.9 µs 133.8–134.0 µs
join-1an order with its customer 51,111/s 19.6 µs 19.5–19.6 µs66,141/s 15.1 µs 15.1–15.1 µs75,000/s 13.3 µs 13.3–13.4 µs
join-100a customer with their 100 orders 10,499/s 95.2 µs 94.2–96.3 µs5,152/s 194.1 µs 193.8–194.3 µs5,534/s 180.7 µs 142.8–218.6 µs
join-top-10the ten customers who spent most: a join, a group by, a sort, over every order 1.4/s 723.9 ms 723.2–724.6 ms1.9/s 528.7 ms 527.4–529.9 ms2.7/s 365.4 ms 355.7–375.2 ms
scan-ordersa sum over every order 52.4/s 19.1 ms 19.0–19.1 ms12.2/s 82.0 ms 81.5–82.5 ms46.6/s 21.5 ms 21.5–21.5 ms
Workload SQLiterusqlite, WALTursoMVCC, writes at onceTurso, WAL?mvcc=off, writes take turns
loada row inserted, the customers then the orders, 100,000 to a statement 353,549/s 2.8 µs 2.8–2.9 µs91,485/s 10.9 µs 10.8–11.1 µs386,769/s 2.6 µs 2.5–2.6 µs
load-checkpointa checkpoint after the load 4,834/s 206.9 µs 188.3–238.4 µs5,997/s 166.8 µs 71.7–280.2 µs137/s 7.2 ms 2.1–14.6 ms
fetch-1an order by its key 95,409/s 10.5 µs 10.0–11.0 µs51,773/s 19.3 µs 18.2–19.9 µs91,191/s 11.0 µs 10.0–11.5 µs
fetch-100100 orders by a range of keys 9,776/s 102.3 µs 101.6–102.8 µs9,171/s 109.0 µs 107.9–110.0 µs10,087/s 99.1 µs 96.1–100.9 µs
fetch-100-by-indexa customer's 100 orders, by an index 12,697/s 78.8 µs 78.0–79.2 µs5,438/s 183.9 µs 179.3–187.6 µs7,296/s 137.1 µs 132.1–164.9 µs
join-1an order with its customer 50,802/s 19.7 µs 19.2–20.2 µs65,667/s 15.2 µs 15.1–15.4 µs77,017/s 13.0 µs 11.8–13.6 µs
join-100a customer with their 100 orders 10,527/s 95.0 µs 93.7–99.4 µs5,095/s 196.2 µs 187.0–223.3 µs6,655/s 150.2 µs 139.0–218.6 µs
join-top-10the ten customers who spent most: a join, a group by, a sort, over every order 1.4/s 712.8 ms 702.9–724.6 ms1.9/s 532.1 ms 526.7–540.4 ms2.8/s 358.4 ms 350.8–375.2 ms
scan-ordersa sum over every order 52.1/s 19.2 ms 18.8–19.6 ms11.9/s 84.0 ms 81.3–91.9 ms46.2/s 21.6 ms 21.2–22.4 ms

The engines: SQLite, SQLite 3.54.1 (rusqlite, WAL); Turso, turso_core 0.8.4 (MVCC, writes at once); Turso, WAL, turso_core 0.8.4 (?mvcc=off, writes take turns). Measured on 2026-11-23, at commit e44eb0d, its load average 2.8 → 3.7 during the run, other work going on: compare the engines with each other rather than with another machine's numbers.

Ran on

Machine
MacBook Pro (Mac17,2)
Processor
Apple M5 (arm64)
Cores
10 (4 performance, 6 efficiency)
Memory
32 GB
Storage
SSD, APFS
System
macOS 27.0.1
Power
mains

What it's made of#

Its browser half
none
endpoints alone: no wasm
Pages and endpoints
0 + 2
route files' pages, and handlers
Lines of Roc
839
its own .roc and .rocx, blank lines left out
Tests
7
6 expects, 1 node tests
Weighs
no browser half: endpoints alone
Made of
0 pages · 2 endpoints · 839 lines of Roc · 6 expects · 1 node test
Uses
SQLite, packages/jobs

Measured on 2026-11-29 at commit 74eec5b. The wasm is the app's browser half, built with --opt=size; every page also loads start.js, the page's JavaScript, 22.8 KB brotli. All the examples says how they're measured.

Run it#

With the toolchain set up (just setup), start it from its own directory: it builds, serves at http://127.0.0.1:8080 and builds again when you save. Its README says what to look at.

cd examples/sqlite-vs-turso && ../../bin/rocx dev

To build it, check it and run its tests, from the repository's root:

just examples sqlite-vs-turso
just examples-release sqlite-vs-turso   # as deployed: rocx build, then the tests against a server built --opt=speed