Skip to content

Update Turso to v0.8.4 and fix the quadratic load - #1009

Merged
alexey-milovidov merged 11 commits into
mainfrom
turso-0.7.0
Nov 26, 2026
Merged

alexey-milovidov merged 11 commits into
mainfrom
turso-0.7.0

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

Bumps the pinned Turso CLI to the latest stable release, v0.8.4 (2026-11-20), and fixes the reason why the load never finished.

Why the load never finished

Measured with tursodb 0.8.4 on the first rows of hits.csv (in tmpfs, so the numbers are CPU time, not disk):

turso/load variant rows CPU time peak WAL peak RSS
per-batch commits, PRAGMA synchronous = OFF (as in main after #1159) 500 thousand 68 s 401 MB 126 MB
per-batch commits, default synchronous (this PR) 500 thousand 7.6 s 4.8 MB 111 MB
per-batch commits, default synchronous (this PR) 2 million 27.8 s 4.6 MB 125 MB
one BEGIN/COMMIT, PRAGMA synchronous = OFF (this PR before) 500 thousand 9.9 s 388 MB 938 MB
one BEGIN/COMMIT, PRAGMA synchronous = OFF (this PR before) 1 million 18.6 s 1421 MB 1678 MB
  • With PRAGMA synchronous = OFF tursodb never records WAL frames as backfilled, so the WAL is never restarted and every commit checkpoints all of it again. The import is quadratic: CPU time follows the square of the table size over the whole 500 thousand rows. This matches the 2026-07-30 and 2026-11-23 runs, which wrote less than 18 GB of db+WAL in 10 hours.
  • With one transaction around the whole import, tursodb needs about 2.4x the size of the table in memory at COMMIT. This matches the 2026-07-28 and 2026-10-03 runs, which wrote ~76 GB of db+WAL and were then killed by a signal on a 32 GiB machine (the 2026-10-03 one, on 0.8.1, after only 2674 seconds).

So turso/load now uses tursodb's defaults: .import commits every batch of 1000 rows by itself, and synchronous is not changed. That is linear, with a WAL below 5 MB and a flat memory usage.

Other changes

  • .import exits with 0 even if rows fail or the input file does not exist, so the load asks for its summary line (-v) and fails unless it shows rows and no errors. tursodb 0.8.4 prints no progress lines, so the filter for them is gone.
  • turso/template.json: added category (enthusiast, as for every new system), removed the SQLite compatible tag, which validate-results.py rejects as a new tag.
  • Q29: tursodb has no REGEXP_REPLACE, so the query now uses the line from sqlite/queries.sql, which extracts the host with INSTR, SUBSTR and IIF. As for SQLite, it is an approximation of the regular expression: it also takes the host from a Referer with no path after it or with no http(s):// prefix. On the first 2 million rows the two give the same key for 93% of the non-empty values; the same hosts come out, with slightly different counts.
  • Merged main; the conflict in turso/load after Turso - it is ridiculously slow, can't believe that: revert the single-transaction import, cap per-query wall-clock #1159 is resolved.

Tested

With tursodb 0.8.4 (aarch64) and the scripts from this branch: check, load on 2 million rows (Added 1999939 rows with 0 errors, the same number of records as Python's csv module finds), data-size, and all 43 queries through query. All 43 succeed; the result of the new Q29 (key, average length, count, minimum) is identical to an independent computation of the same formulation in Python. The load fails with a message on a missing hits.csv and on a malformed row.

Runs

  • 2026-11-25, before the Q29 change: the load took 2354 seconds (Added 99997497 rows with 0 errors), and 32 of 43 queries finished before the run was stopped by the 10-hour limit. The launch action ignored turso/timeout-seconds; that is fixed in Still trying to fix Turso - it's unbelievably slow #3600.
  • 2026-11-26, launched manually with a 24-hour limit: finished in 13.7 hours (49480 seconds). The results are committed as turso/results/20261126/c6a.4xlarge.json: load 2362 seconds (Added 99997497 rows with 0 errors), data size 68.7 GB, 41 of 43 queries. Q5 and Q6 (COUNT(DISTINCT ...)) exceed the 600-second limit per query and are null; the other queries take 307 to 570 seconds on hot runs.
  • A second run on the same day, started before the Q29 change, agrees with it: the median difference of the hot runs is 0.18%, the largest is 3.8% (Q9).

🤖 Generated with Claude Code

Bump the pinned Turso CLI from v0.1.2-pre.4 to the latest stable
release. The v0.7.0 installer still creates ~/.turso/env on a fresh
machine, so the existing source lines keep working. Verified locally:
install, check, DDL from create.sql, and a CSV .import round trip all
succeed on 0.7.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

The run of turso on c6a.4xlarge did not produce results.

Logs:

@alexey-milovidov

Copy link
Copy Markdown
Member Author

Does not fit into the global timeout just a little.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

With five minutes per query, it will likely need a few days to run.

@alexey-milovidov alexey-milovidov self-assigned this Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The run of turso on c6a.4xlarge did not produce results.

Logs:

@alexey-milovidov alexey-milovidov changed the title Update Turso to v0.7.0 Update Turso to v0.7.0, but it cannot finish the benchmark in reasonable time. Jul 30, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Let's try again. I want to finish this PR.

https://news.ycombinator.com/item?id=49935239

alexey-milovidov and others added 2 commits October 2, 2026 23:32
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@alexey-milovidov alexey-milovidov changed the title Update Turso to v0.7.0, but it cannot finish the benchmark in reasonable time. Update Turso to v0.8.1 Oct 2, 2026
@alexey-milovidov alexey-milovidov changed the title Update Turso to v0.8.1 Update Turso to v0.8.1, will it help, maybe? Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

The run of turso on c6a.4xlarge did not produce results.

Logs:

@alexey-milovidov alexey-milovidov changed the title Update Turso to v0.8.1, will it help, maybe? Update Turso to v0.8.1, will it help, maybe? Upd: it didn't. Oct 3, 2026
…te.json

tursodb 0.8 prints no progress lines during .import, so grep -v exited 1
and set -e aborted ./load silently right after the download.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

The run of turso on c6a.4xlarge did not produce results.

Logs:

@alexey-milovidov

Copy link
Copy Markdown
Member Author

No matter how hard I try, it does not work :(

alexey-milovidov and others added 2 commits November 25, 2026 02:16
Bump the pinned Turso CLI from v0.8.1 to the latest stable release,
v0.8.4, and add the `category` field that `template.json` requires now.

Drop `PRAGMA synchronous = OFF` from `turso/load`. In this mode tursodb
never records WAL frames as backfilled, so the WAL is never restarted
and every commit checkpoints all of it again, which makes the import
quadratic. Measured on tursodb 0.8.4 in tmpfs, first rows of `hits.csv`:

- 500 thousand rows with the pragma: 68 CPU seconds, WAL 401 MB;
- 500 thousand rows with defaults: 7.6 CPU seconds, WAL 4.8 MB;
- 2 million rows with defaults: 27.8 CPU seconds, WAL 4.6 MB,
  peak RSS 125 MB.

This is why the 2026-07-30 and 2026-11-23 runs wrote less than 18 GB of
db+WAL in 10 hours. The other variant, one transaction around the whole
import, needs about 2.4x the size of the table in memory at `COMMIT`
(938 MB for 389 MB, 1.68 GB for 708 MB), which is what killed the
2026-07-28 and 2026-10-03 runs on a 32 GiB machine.

`.import` exits with 0 even if rows fail or the input file is missing,
so the load asks for its summary line (`-v`) and fails unless it shows
rows and no errors. tursodb 0.8.4 prints no progress lines, so the
filter for them is gone.

#1009

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`validate-results.py` allows only the tags that already exist in the
base branch, and this tag was used by this template alone:

    error: turso/template.json: new tag 'SQLite compatible' is not allowed; use one of the existing tags

https://github.com/ClickHouse/ClickBench/actions/runs/45533452478
#1009

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@alexey-milovidov
alexey-milovidov deployed to benchmark-approval November 25, 2026 02:40 — with GitHub Actions Active
@alexey-milovidov alexey-milovidov changed the title Update Turso to v0.8.1, will it help, maybe? Upd: it didn't. Update Turso to v0.8.4 and fix the quadratic load Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The run of turso on c6a.4xlarge did not produce results.

Logs:

tursodb has no `REGEXP_REPLACE` (`Parse error: no such function:
REGEXP_REPLACE`), so Q29 could only produce a null. Use the line from
`sqlite/queries.sql`, which extracts the host with `INSTR`, `SUBSTR` and
`IIF`, so that Turso and SQLite run the same text.

Checked with tursodb 0.8.4 on the first 2 million rows of `hits.csv`:
the line runs through `turso/query`, its result (key, average length,
count, minimum) is identical to an independent computation of the same
formulation in Python, and all 43 queries succeed now.

As for SQLite, this is an approximation of the regular expression: it
also takes the host from a `Referer` that has no path after it or no
`http(s)://` prefix, where the regular expression leaves the whole
string. On those rows the two give the same key for 93% of the non-empty
values of `Referer`; the same hosts come out, with slightly different
counts.

#1009

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Results for turso are ready for: c6a.4xlarge.
The result files are committed as c82620b.
Preview of the benchmark page with these results

Logs:

@github-actions

Copy link
Copy Markdown
Contributor

Results for turso are ready for: c6a.4xlarge.
The result files are committed as 1ab157b.
Preview of the benchmark page with these results

Logs:

@alexey-milovidov
alexey-milovidov merged commit a08349a into main Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant