Repository navigation
perf(spiraldb): reuse the pinned table handle and schema on every read #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eywalker
merged 6 commits into
main
from
eywalker/itl-1774-spiraldb-source-avoid-per-read-setup
Nov 30, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f6f298d
perf(spiraldb): reuse the pinned table handle and schema on every read
eywalker 9e46787
fix(spiraldb): check asof sources, refuse a missing table, serialize …
eywalker 6f44038
chore: merge main into SpiralDB source read optimization
eywalker ba217b5
Merge remote-tracking branch 'origin/main' into eywalker/itl-1774-spi…
eywalker 245532b
fix(spiraldb): hold every refusal a check raises; prepare a given aso…
eywalker 6bc2aed
docs(changelog): clarify asof zero behaviour
eywalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ### Added | ||
|
|
||
| - `SpiralDBTableSource.pinned_version` (the table version every read scans) and | ||
| `SpiralDBTableSource.has_newer_version()`, which says whether the table has a newer | ||
| version. It makes one metadata lookup, reads no row, and moves nothing. | ||
| `check_for_new_data()`, which every run calls first, moves the pin. `head()` and the | ||
| notebook preview never call either. | ||
|
|
||
| ### Changed | ||
|
|
||
| - A `SpiralDBTableSource` read makes no metadata round trip (ITL-1774). It reuses the table | ||
| handle of the pinned version, its schema and its recorded schema, kept from the build. | ||
| spiral-sdk's keyed table handle is an immutable snapshot, so a read still returns | ||
| exactly the pinned version's rows. Rows, types and order are unchanged on every route. | ||
| Before, each read opened the table by name again and read the dataset's schema record | ||
| again. Measured on a test project, a one-row restricted read went from about 3.2 s to | ||
| about 2.1 s. `check_for_new_data()` still looks the table up, pins a newer version and | ||
| replaces the handle with it. | ||
| - A table dropped and created again, a table that is gone, a table whose columns changed, | ||
| and a schema record that cannot be read are now found by `check_for_new_data()`. Every | ||
| run calls it first. A source built with `asof` is checked too: one lookup, plus its own | ||
| version's schema record. Its pin never moves. Before, its check read nothing. | ||
| After a check refuses the table, every read of the source refuses too, before scanning, | ||
| until a later check accepts the table. A read outside a run (`as_table()`, | ||
| `iter_data()`, `head()`) of a table replaced since the last check now reads the pinned | ||
| version of the original table, or raises the store's error if that version is gone. | ||
| Before, it refused with "dropped and created again". A table that now has a column | ||
| in the system-tag namespace is refused and held the same way. | ||
| - A `SpiralDBTableSource` built with `asof` takes its columns from that version, prepared | ||
| at build, so its first read also makes no metadata round trip. On `main`, a source | ||
| configured with `asof=0` (the version before the table's first write, with only key | ||
| columns) built with the latest version's columns and returned zero rows on reads, | ||
| and now the build rejects `asof=0` because that version has no data columns. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.