Repository navigation
Update Turso to v0.8.4 and fix the quadratic load - #1009
Conversation
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>
|
The run of Logs:
|
|
Does not fit into the global timeout just a little. |
|
With five minutes per query, it will likely need a few days to run. |
|
The run of Logs:
|
|
Let's try again. I want to finish this PR. |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The run of Logs:
|
…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>
|
The run of Logs:
|
|
No matter how hard I try, it does not work :( |
# Conflicts: # turso/load
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>
|
The run of 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>
|
Results for Logs:
|
|
Results for Logs:
|
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/loadvariantPRAGMA synchronous = OFF(as inmainafter #1159)synchronous(this PR)synchronous(this PR)BEGIN/COMMIT,PRAGMA synchronous = OFF(this PR before)BEGIN/COMMIT,PRAGMA synchronous = OFF(this PR before)PRAGMA synchronous = OFFtursodb 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.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/loadnow uses tursodb's defaults:.importcommits every batch of 1000 rows by itself, andsynchronousis not changed. That is linear, with a WAL below 5 MB and a flat memory usage.Other changes
.importexits 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: addedcategory(enthusiast, as for every new system), removed theSQLite compatibletag, whichvalidate-results.pyrejects as a new tag.REGEXP_REPLACE, so the query now uses the line fromsqlite/queries.sql, which extracts the host withINSTR,SUBSTRandIIF. As for SQLite, it is an approximation of the regular expression: it also takes the host from aRefererwith no path after it or with nohttp(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.main; the conflict inturso/loadafter 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,loadon 2 million rows (Added 1999939 rows with 0 errors, the same number of records as Python'scsvmodule finds),data-size, and all 43 queries throughquery. 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 missinghits.csvand on a malformed row.Runs
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 ignoredturso/timeout-seconds; that is fixed in Still trying to fix Turso - it's unbelievably slow #3600.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.🤖 Generated with Claude Code