perf(8.0): bound find({ where, orderBy }) sort to the page (CTX-BR-FIND-ORDERBY)
A filtered + ordered find() materialized the FULL sorted match set before slicing the page — passing k = filteredIds.length to the column store's filteredSortTopK. A broad filter + orderBy returning 20 rows at billion scale produced hundreds of millions of sorted ids to discard all but the page (O(matches) heap). Thread the page bound (offset + limit + the hidden-tier over-fetch) into getSortedIdsForFilter → filteredSortTopK / sortTopK / the sparse-path slice, so the sort produces only the page. Ordering and pagination are unchanged. From cor's 2026-06-24 co-release scaling audit (item 1). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
82dde92077
commit
450084b6ce
5 changed files with 93 additions and 10 deletions
|
|
@ -73,6 +73,11 @@ no separate migration doc. **`8.0.0-rc.2` is live** — install with
|
|||
> matches that DO pass the filter, rather than coming back empty. No API change. With the native
|
||||
> `@soulcraft/cor` 3.0 stack the matched universe is forwarded as an opaque roaring buffer with
|
||||
> zero id materialization in TypeScript; the pure-JS path restricts the beam walk with a string set.
|
||||
> - **`find({ where, orderBy })` bounds the sort to the page.** A broad filter + `orderBy`
|
||||
> returning one page no longer materializes every matching sorted id (it produced the full sorted
|
||||
> match set, then sliced) — the page bound (`offset + limit`) is threaded into the column store's
|
||||
> top-K sort, so returning 20 rows from a million matches stays a bounded-K heap. No API change;
|
||||
> ordering and pagination are unchanged.
|
||||
> - **`brain.graph.subgraph()` accepts a query (query→expand).** The seed selector now takes not
|
||||
> just entity id(s) but a `find()` result or a `FindParams` query — `brain.graph.subgraph({ where:
|
||||
> { team: 'platform' } }, { depth: 1 })` runs the query and expands the neighborhood of every
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue