Repository navigation
Conversation
Every chunk read ran one DuckDB search per time step, about 30-40 ms each and one at a time on lazycogs' single DuckDB executor. On a year of Sentinel-2 over 40 km at 20 m with 1024-pixel chunks, those 738 searches took 31.6 s of a 50 s load. open() now runs one search, with the array's bbox, datetime, filter, ids and sortby, and keeps the results in an ItemCache. Each chunk's search is answered from it, matching footprints and times as DuckDB does, in the query's order. The cache holds no DuckDB client, so arrays pickle and dask.distributed workers no longer need to read href. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Closing in favour of #94: this is a big change to how lazycogs queries, so it's better discussed there first. The branch stays on my fork for reference. |
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.
Every chunk read runs one DuckDB search per time step. Each takes ~30-40 ms here, and they run one at a time on lazycogs' single DuckDB executor, so they cap how fast a chunked load can go.
open()now runs one search with the array's bbox, datetime, filter, ids and sortby, and keeps the results in a smallItemCache. Each chunk's search is answered from it. The cache has the samesearch()signature, so the backend,explain()and their tests are unchanged.Results. A year of Geoscience Australia's Sentinel-2 ARD over Canberra, one band at 20 m,
chunks={"time": 1, "y": 1024, "x": 1024}, threaded scheduler, two runs each:The outputs are identical. Before, the 40 km load ran 738 DuckDB searches, taking 31.6 s in all.
Same items as DuckDB.
start_datetime/end_datetimecoalesced withdatetime, and a bare date running from midnight to 23:59:59.ST_Intersectsdoes, holes and MultiPolygons included, rather than a bbox comparison.sortbyand the mosaic order don't change.test_item_cache.pychecks the cache returns the same items in the same order asDuckdbClient.search, over 80 combinations of awkward footprints and datetime filters.Also: the backend no longer holds a DuckDB client, so arrays pickle, and
dask.distributedworkers don't need to readhref. That supersedes #92, which I'll close if you take this.Tradeoffs
open()already scans every matching row to find the time steps; now it also reads their footprints and assets.Alternatives we considered
read_parquet~26 ms, and a query on a table pre-loaded into DuckDB's memory ~10 ms. That's at best 3× faster, still one at a time, and the client still can't be pickled.href.dask.distributedfor default clients, but keeps the per-chunk queries and needshrefreadable on every worker.This merges cleanly onto #88, and the combined test suite passes.
🤖 Generated with Claude Code