Repository navigation
DuckDB: bulk writes - #45
Merged
Merged
Conversation
PR 44 is merged and the CI is green on main. What is left is staging, the operations drills and the release, which the release plan tracks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Register the sensors, units, labels and strings of a whole batch with chunked lookups and appenders instead of a few statements per sensor and per string, and write the samples through one appender per value table instead of one per sensor. 3000 new series: 2.69 s to 0.23 s; 3000 series of strings: 2.51 s to 0.20 s. Nothing is cached any more, so a rolled back batch leaves no stale sensor id, and the cache clearing of deletions and test cleanup is gone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Also correct the backends page: DuckDB stores microsecond timestamps since the TIMESTAMP_MS columns were replaced. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Writing a batch to DuckDB now costs a handful of statements whatever the number of series or strings, like PostgreSQL, TimescaleDB and ClickHouse.
duckdb_registration.rs: sensors, units, label names and descriptions, strings and labels of a whole batch are looked up with chunkedINlists and inserted through appenders (add_column, so ids still come from the table sequences).duckdb_publishers.rs: one appender per value table for the whole batch instead of one per sensor; string samples use the batch dictionary.#[cached]wrappers are gone (withforget_sensor_idand the cache clears). They were filled inside the transaction, so a rollback could leave ids of sensors that were never committed.Numbers
Release build, DuckDB file, same machine and scripts (
tests/perf/scale.sh 3000,tests/perf/strings.sh 3000), one run each, indicative:Reads are unchanged. The aggregated selector read is still one query per series (about 0.3 s for 100 series); it is noted in
done/duckdb-bulk-writes.mdas a separate task.Tests
clippy --tests -D warningson both. The backend-generic tests (2100 new sensors in a batch, string dictionaries, labels written once, concurrent first writes) cover this path.cargo test --docwith the duckdb feature cannot findlibduckdb.dylibon macOS locally; CI is not affected.Docs
Task file moved to
done/, the ClickHouse pre-production task closed (PR 44 is merged, CI green), anddocs/BACKENDS.mdcorrected: DuckDB has stored microsecond timestamps since theTIMESTAMP_MScolumns were replaced.🤖 Generated with Claude Code