diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d7cd3fd0d..9117079e3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Performance + +- **Skip sorting proven ordered input** (#641, first slice). Plain queries can omit `Sort` when a committed integer, float, or Boolean range already provides the complete ascending result order. Attribute scans use AVET; entity-and-attribute scans retain their selective EAVT range. `:offset` and `:limit` then stop reading early, so memory-limit (`QRY-012`) or I/O errors in unread later input may be avoided. The proof uses the query's pinned reader, including a large write transaction's working trees, and rejects pending or staged records in the source range, mixed kinds, unsupported comparators, tie suffixes, order-changing operators, user callbacks and `collect-set`. Unproven queries retain their original plan. Aggregates and windows still buffer their full input in this slice. + ### Breaking changes - **`Value` is `#[non_exhaustive]` and has a `Set` variant** (#316). A `match` on `Value` outside the crate needs a wildcard arm, so later value kinds are not breaking changes. diff --git a/CLAUDE.md b/CLAUDE.md index 1ed0eb962d..4992873c03 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -108,7 +108,7 @@ cargo run < demos/demo_negation.txt 1. **`src/graph/`** — EAV fact store with bi-temporal support - `types.rs`: `Fact`, `Value`, `EntityId`, `TxId`, `VALID_TIME_FOREVER` - - `storage.rs`: `FactStorage` — in-memory store, `snapshot()` → `Snapshot` (committed reader + pin + pending prefix, and a `WriteTransaction`'s staged facts read with the pending ones as one store, #550; every query/cursor/log read goes through one), `transact_batch`, `retract`, `get_facts_as_of`, `get_facts_valid_at`, `net_asserted_facts`, `get_facts_by_entity_attribute_indexed` + - `storage.rs`: `FactStorage` — in-memory store, `snapshot()` → `Snapshot` (committed reader + pin + pending prefix, and a `WriteTransaction`'s staged facts read with the pending ones as one store, #550; every query/cursor/log read goes through one), `transact_batch`, `retract`, `get_facts_as_of`, `get_facts_valid_at`, `net_asserted_facts`, `get_facts_by_entity_attribute_indexed`; `Snapshot::has_pending` probes only its captured pending/staged source range for input-order proofs (#641) 2. **`src/storage/`** — Persistence layer - `mod.rs`: `StorageBackend` trait, `LegacyHeaderV7` (v7 migration only), `CommittedReader` trait @@ -122,7 +122,7 @@ cargo run < demos/demo_negation.txt - `btree.rs`: On-disk B+tree over byte keys (`build_btree`, `cow_update` (copy-on-write inserts and deletes; an emptied leaf or node leaves its parent, an emptied tree is root 0; #550) and `cow_insert`, `LeafCursor` (with `seek`), `prefix_scan`, `get`, `MutexStorageBackend`) - `dict.rs`: `DictReader` (id ↔ UUID/ident, tx timestamps, long values; `uuids_of` walks dense id batches with `LeafCursor` and uses exact scalar reads for sparse/small batches, #530) and `Encoder` (checkpoint-time id assignment and key building) - `value_pages.rs`: append-only value pages for strings over 64 bytes and sets whose element encoding is over 64 bytes (#316; DICT dedup compares bytes, `long_bytes`/`find_long_bytes`) - - `reader.rs`: `OnDiskReader` — covering reads of committed facts (`CommittedReader`, `KeySource`); query scans use the resumable `live_keys` to decide net-assert on index keys (#379) among the versions a `TxBound` keeps; `live_facts` is test-only, and production fact-level net-assert handles pending records (#532, superseded by #551); `tx_order` (cached per reader), `last_tx_at`, `tx_runs` over the DICT's transactions (#551) + - `reader.rs`: `OnDiskReader` — covering reads of committed facts (`CommittedReader`, `KeySource`); query scans use the resumable `live_keys` to decide net-assert on index keys (#379) among the versions a `TxBound` keeps; `live_facts` is test-only, and production fact-level net-assert handles pending records (#532, superseded by #551); `KeySource::any_key` proves raw kind-prefix presence with one leaf seek, including historical/retracted keys (#641); `tx_order` (cached per reader), `last_tx_at`, `tx_runs` over the DICT's transactions (#551) - `verify.rs`: integrity walk for `Minigraf::verify` (tree order, index digests, DICT, page accounting) and the source choice for `rebuild_indexes` (#373) - `meta.rs` / `page.rs` / `freelist.rs`: meta pages A/B, the common page header and allocator (skips quarantined ids), free-list chain - `pins.rs`: `Pins` / `GenerationPin` — generations held by open snapshots and the quarantine of pages checkpoints freed after them (#543) @@ -148,7 +148,7 @@ cargo run < demos/demo_negation.txt - `prepared.rs`: `BindValue`, `PreparedQuery` — parse-once/execute-many with named `$slot` bind slots; `prepare_query`, `substitute`; `Entity` and `Val(Ref)` fit each other's slots, bind mistakes are `API-022`/`023`/`024` (#181); a `:limit $n` or `:offset $o` slot takes `Val(Integer(n >= 0))` (`resolve_count_slot`, #306) - `magic_sets.rs`: Magic-sets rewriting for demand-driven recursive rule evaluation (not applied to rules with `not`/`not-join`) -3a. **`src/query/engine/`** — Streaming query engine (#473), runs every query (#551): `plan.rs` (the operator tree of every query, or the executor's error code for it: patterns, expression clauses, `not`/`not-join` and `or`/`or-join`, and rule invocations, read as patterns of their relations (`plan_rules`, #548; a magic-set head constant is `HeadArg::Const`), in `optimizer::plan` order, then the `or`s in text order, then the deferred `not`s; an `or` branch or a `not` body is planned as a `:where` is; a clause list with no pattern first starts from `Seed`; a constant no cell equals is `Term::Never`, a scan that reads nothing; `:as-of` resolved when the query opens (`Snapshot::tx_bound`: a counter bound when `tx_id` rises with `tx_count`, else `TxBound::Timestamp`: committed `tx_count` ranges and pending `tx_id <= t`); a per-fact pseudo-attribute pattern reads the metadata column its source's scan fills (the hidden variable the parser named, #594), and `:db/valid-at` joins as `[e _ _]`; plain `:find` variables, aggregates with `:with`, and window functions, over an aggregate's groups too), `scan.rs` (one pattern over committed key ranges via `CommittedReader::key_source`/`live_keys`, AVET ranges for cross-kind constants, then the pending range by whole runs; one entity per probe for a join), `join.rs` (`IndexNestedLoopJoin` when the pattern's entity is bound, or, under a constant attribute and entity not constant, its value (#721: per outer row the AVET ranges of the values that join-equal it and the attribute's pending facts with its key, read once per query in `IdSpace::probes`; an entity cell needs the keyword naming it, known only where the query made the entity from a keyword (rule heads, magic seeds), else the join becomes the planner's `HashJoin`); `HashJoin` otherwise, and on a relation; `JoinKey`: floats by IEEE `==`, a keyword equals a ref to the entity it names), `filter.rs` (`Filter`/`Bind` and pseudo-attribute steps over batches; a `Bind` on a bound slot keeps the rows where the result is join-equal, #596), `collect.rs` (`CollectSet`, #316: `[(collect-set ?e :a) ?s]` per row probes `[e :a ?v]` as an `IndexNestedLoopJoin` does and binds the values as one set, `#{}` when none, metered; `Expr::CollectSet`, parsed only as a whole binding clause), `anti.rs` (`AntiJoin`, #546: a body with the same rows for every outer row runs once into a hash set of its imported-variable keys; any other body, or one whose first pattern's entity is imported, runs per outer row from `seed.rs`'s one-row `Seed`, via `Operator::rewind`; never deduplicates), `aggregate.rs` (`Aggregate`, #547: a hash table of groups keyed on cells as `Value`'s `Ord` compares values, one entry when ungrouped; `count`/`count-distinct` on cells, other aggregates on values via `datalog::aggregate::Agg`; groups sorted by value and finished in that order; a float group shows its least value by `value_order`), `sort.rs` (`Sort`, #306: the `:find` columns as values, in the full order of `:order-by` — its keys, then every other `:find` column ascending, by `datalog::aggregate::row_order`/`value_order`; under a `:limit` a heap of the best `offset + limit` rows; reads its whole input, dropping the DICT lookups after each batch, metered; its rows turned back into cells only as returned), `limit.rs` (`Limit`, #306: skips `offset` rows, passes on at most `limit`, then closes its child so nothing below reads more; planned after the last step, after `Builder::finish`, and after `Sort`), `window.rs` (`Window`, #547: holds each input row's passed-on cells and its named variables' values, then computes every window with `datalog::aggregate::windows`, the executor's code, and returns the rows in input order), `union.rs`/`distinct.rs` (`Union` and `Distinct`, #546: each `or` branch planned as a `not` body is, hashed into a table or run per outer row; then one row per distinct binding, as the executor's `Value`s compare; `:distinct` adds `DistinctFind` after aggregates/windows and before sorting/pagination, keyed on final `:find` columns by aggregate-group equality, with canonical float zero/NaN output including set elements, #493), `cell.rs`/`batch.rs` (id cells in columnar batches of 1,024), `ids.rs` (DICT and provisional ids, `keyword_eid`), `project.rs` (ids → values for returned rows only; bounded stack UUID hints share DICT paths, with cache insertion and charges in projection order, #530), `relation.rs`/`recursive.rs` (#548: rule queries; a relation per evaluated predicate holds its derived rows, a set by `encode_value` identity, appended per round so `Old`/`Delta`/`Full` are ranges; `Recursive` runs each stratum's semi-naive rounds, one run per same-stratum top-level invocation, a rule reading its stratum otherwise run in full every round; scans read derived rows after committed and pending ones, with `nil` metadata), `meter.rs` (#549: one `Meter` per query, shared by every holder of state through a `Held` — hash join build sides, `not`/`or` tables, distinct sets, aggregate groups, window rows, rule relations and their temporaries, `IdSpace`, the set a `CollectSet` builds; each entry charged by a per-entry estimate including retained set elements and strings before it is inserted, containers grown with `try_reserve`, released on `rewind`/`close`/drop; over `OpenOptions::query_memory_limit`, or a refused allocation, is `QRY-012`; `Stream::close` drops the operator tree, keeping its counters). `mod.rs`: `Operator` (`next_batch`/`rewind`/`close`/`counters`), `Stream` (the operator tree over an owned `Snapshot`, pulled one batch at a time). `DatalogExecutor::open` / `execute_query` run every query on it: a cursor gets the `Stream` (`Answer::Stream`), `execute` drains it. +3a. **`src/query/engine/`** — Streaming query engine (#473), runs every query (#551): `plan.rs` (the operator tree of every query, or the executor's error code for it: patterns, expression clauses, `not`/`not-join` and `or`/`or-join`, and rule invocations, read as patterns of their relations (`plan_rules`, #548; a magic-set head constant is `HeadArg::Const`), in `optimizer::plan` order, then the `or`s in text order, then the deferred `not`s; an `or` branch or a `not` body is planned as a `:where` is; a clause list with no pattern first starts from `Seed`; a constant no cell equals is `Term::Never`, a scan that reads nothing; `:as-of` resolved when the query opens (`Snapshot::tx_bound`: a counter bound when `tx_id` rises with `tx_count`, else `TxBound::Timestamp`: committed `tx_count` ranges and pending `tx_id <= t`); a per-fact pseudo-attribute pattern reads the metadata column its source's scan fills (the hidden variable the parser named, #594), and `:db/valid-at` joins as `[e _ _]`; plain `:find` variables, aggregates with `:with`, and window functions, over an aggregate's groups too), `scan.rs` (one pattern over committed key ranges via `CommittedReader::key_source`/`live_keys`, AVET ranges for cross-kind constants, then the pending range by whole runs; one entity per probe for a join), `join.rs` (`IndexNestedLoopJoin` when the pattern's entity is bound, or, under a constant attribute and entity not constant, its value (#721: per outer row the AVET ranges of the values that join-equal it and the attribute's pending facts with its key, read once per query in `IdSpace::probes`; an entity cell needs the keyword naming it, known only where the query made the entity from a keyword (rule heads, magic seeds), else the join becomes the planner's `HashJoin`); `HashJoin` otherwise, and on a relation; `JoinKey`: floats by IEEE `==`, a keyword equals a ref to the entity it names), `filter.rs` (`Filter`/`Bind` and pseudo-attribute steps over batches; a `Bind` on a bound slot keeps the rows where the result is join-equal, #596), `collect.rs` (`CollectSet`, #316: `[(collect-set ?e :a) ?s]` per row probes `[e :a ?v]` as an `IndexNestedLoopJoin` does and binds the values as one set, `#{}` when none, metered; `Expr::CollectSet`, parsed only as a whole binding clause), `anti.rs` (`AntiJoin`, #546: a body with the same rows for every outer row runs once into a hash set of its imported-variable keys; any other body, or one whose first pattern's entity is imported, runs per outer row from `seed.rs`'s one-row `Seed`, via `Operator::rewind`; never deduplicates), `aggregate.rs` (`Aggregate`, #547: a hash table of groups keyed on cells as `Value`'s `Ord` compares values, one entry when ungrouped; `count`/`count-distinct` on cells, other aggregates on values via `datalog::aggregate::Agg`; groups sorted by value and finished in that order; a float group shows its least value by `value_order`), `order.rs` (#641: snapshot-bound proofs of the complete result order; safe committed integer/float/Boolean ranges can set the private `ScanSpec.index` hint to AVET and omit Sort, with `plan.find` restored from Sort.cols; entity-and-attribute scans retain EAVT; pending/staged records in that range, mixed kinds, DICT comparators, callbacks and CollectSet keep the original plan; `minigraf::__input_order` forces fallback under `test-hooks`), `sort.rs` (`Sort`, #306: the `:find` columns as values, in the full order of `:order-by` — its keys, then every other `:find` column ascending, by `datalog::aggregate::row_order`/`value_order`; under a `:limit` a heap of the best `offset + limit` rows; reads its whole input, dropping the DICT lookups after each batch, metered; its rows turned back into cells only as returned), `limit.rs` (`Limit`, #306: skips `offset` rows, passes on at most `limit`, then closes its child so nothing below reads more; planned after the last step, after `Builder::finish`, and after `Sort`), `window.rs` (`Window`, #547: holds each input row's passed-on cells and its named variables' values, then computes every window with `datalog::aggregate::windows`, the executor's code, and returns the rows in input order), `union.rs`/`distinct.rs` (`Union` and `Distinct`, #546: each `or` branch planned as a `not` body is, hashed into a table or run per outer row; then one row per distinct binding, as the executor's `Value`s compare; `:distinct` adds `DistinctFind` after aggregates/windows and before sorting/pagination, keyed on final `:find` columns by aggregate-group equality, with canonical float zero/NaN output including set elements, #493), `cell.rs`/`batch.rs` (id cells in columnar batches of 1,024), `ids.rs` (DICT and provisional ids, `keyword_eid`), `project.rs` (ids → values for returned rows only; bounded stack UUID hints share DICT paths, with cache insertion and charges in projection order, #530), `relation.rs`/`recursive.rs` (#548: rule queries; a relation per evaluated predicate holds its derived rows, a set by `encode_value` identity, appended per round so `Old`/`Delta`/`Full` are ranges; `Recursive` runs each stratum's semi-naive rounds, one run per same-stratum top-level invocation, a rule reading its stratum otherwise run in full every round; scans read derived rows after committed and pending ones, with `nil` metadata), `meter.rs` (#549: one `Meter` per query, shared by every holder of state through a `Held` — hash join build sides, `not`/`or` tables, distinct sets, aggregate groups, window rows, rule relations and their temporaries, `IdSpace`, the set a `CollectSet` builds; each entry charged by a per-entry estimate including retained set elements and strings before it is inserted, containers grown with `try_reserve`, released on `rewind`/`close`/drop; over `OpenOptions::query_memory_limit`, or a refused allocation, is `QRY-012`; `Stream::close` drops the operator tree, keeping its counters). `mod.rs`: `Operator` (`next_batch`/`rewind`/`close`/`counters`), `Stream` (the operator tree over an owned `Snapshot`, pulled one batch at a time). `DatalogExecutor::open` / `execute_query` run every query on it: a cursor gets the `Stream` (`Answer::Stream`), `execute` drains it. 4. **`src/temporal.rs`** — UTC-only timestamp parsing (avoids chrono CVE GHSA-wcg3-cvx6-7396) @@ -216,7 +216,7 @@ Auto-migrates v7 → v8 on open (spec §9, with a backup meta page). v1–v6 are ## Test Coverage -**1911 tests** (1896 passing, 15 ignored; unit + integration + doc). Engine answers once checked by the executor are frozen in `tests/answers/` (#551). +**1941 tests** (1926 passing, 15 ignored; unit + integration + doc). Engine answers once checked by the executor are frozen in `tests/answers/` (#551). See `docs/TEST_COVERAGE.md` for the full per-file breakdown. **Testing conventions** — see the Testing Conventions section below before writing any tests. @@ -228,6 +228,7 @@ See `docs/TEST_COVERAGE.md` for the full per-file breakdown. Current plan (see `ROADMAP.md` and the milestones): - **v2.x** (`main`, format v7) now gets only data-integrity and security fixes as patch releases (v2.0.3 is the first); v2.0.2 was the last planned v2.x release. - **v3.0.0** (format v8 and data integrity, plus `:limit` #306, optional `:distinct` output #493, `lag`/`lead` #182, sliding row frames #183, query profiler #185, set membership predicates #316 and prepared queries in every binding #181, UDF registration in every binding #180; tracker #383) is developed on the long-lived `v3` branch. All v3 PRs target `v3`; `main` stays untouched. CI runs on PRs to `v3` the same as on PRs to `main`. Do not merge `main` into `v3` routinely: `main` only gets backports of fixes already on `v3`. Shared CI and workflow changes land on both branches as separate PRs. Just before the v3.0.0 cut, merge `main` into `v3` once (merge commit; source conflicts resolved to `v3`, `main`'s v2.0.x CHANGELOG sections brought over) so the cut is a fast-forward. At the first v3 release, the current `main` is copied to `v2` and `v3` becomes the new `main`. +- **Input order (#641)** targets v3.0.0 in three slices: committed scalar Sort omission is implemented on `v3`; one-group count/count-distinct and partition-at-a-time windows remain pending. The reviewed design, fallback scope and acceptance gates are in `docs/superpowers/specs/2026-10-28-641-input-order-design.md`. - **v3.next** (the release after v3.0.0) holds new features (rule persistence #241; OPFS `BrowserDb` #441). - Known v2.x data issue: same-transaction multi-valued facts (#371). Fix ships in v3.0.0. All v2.x known issues are listed in pinned issue #421 (`known-issue` label); `data-integrity`/`corruption`/`durability` issues fixed in a v2.x patch stay open until that patch is published; issues fixed on the unreleased `v3` branch close on merge (closing keywords do not fire on `v3`, so close them with `gh issue close`) and stay listed in #421 (CONTRIBUTING.md). - Support policy and tiers: PHILOSOPHY.md §7 and §10. v2.x gets data-integrity and security fixes for 12 months after v3.0.0. Tier 1 = Rust + Python + browser WASM (from v3.0.0); other bindings are Tier 2. diff --git a/README.md b/README.md index e3ce418f15..1230cf9a13 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ For example, `(lag ?salary :over (:partition-by ?dept :order-by ?hire-date))` re The unreleased v3.0.0 branch adds bounded sliding windows such as `(avg ?salary :over (:partition-by ?dept :order-by ?hire-date :rows 2 preceding))` (#183). +On v3.0.0, an ascending value-only query such as `[:find ?v :where [?e :score ?v] :order-by [?v] :limit 10]` can read directly in index order and stop early when all committed `:score` history has one value kind (integer, float, or Boolean) and its source range has no pending writes. A query whose full order cannot be proved uses the existing sort (#641). + **Status**: See [ROADMAP.md](ROADMAP.md) for planned work and current direction. ## Why Datalog? diff --git a/ROADMAP.md b/ROADMAP.md index fdf2ea59e5..60190c6224 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -98,7 +98,7 @@ Scope — query API: - Bounded sliding row frames, `:rows N preceding`, for window aggregates (#183; v3.0.0, implemented on `v3`; builds on #182) - Cursor API: `Minigraf::query` and `PreparedQuery::query` return an owned `Cursor` that delivers rows in batches, with the answer fixed at open (#432; Rust API done on `v3`). The binding cursor objects follow. Behind the cursor, the streaming engine (#473) runs every query and produces rows as they are pulled: patterns, expressions and pseudo-attributes (#544), joins and `:db/valid-at` (#545), `not` and `or` (#546), aggregates and windows (#547), rules (#548), and transaction reads (#550); the executor's query path is gone (#551; done on `v3`). Operators do not spill: memory follows operator state, with an opt-in per-query limit (`QRY-012`, #549). - Projected UUID lookup batches walk dense DICT ranges (#530; implemented on `v3`), keeping temporary memory bounded to a batch and query-cache charges in projection order. -- Native `:limit N`, `:order-by` and `:offset`, with a top-k `Sort` whose memory follows `N` (#306; done on `v3`, with the 10M-fact acceptance tests moved from #473; spec `docs/superpowers/specs/2026-10-24-limit-order-by-design.md`). Skipping the sort when an index already returns the rows in order is #641 (v3.next). +- Native `:limit N`, `:order-by` and `:offset`, with a top-k `Sort` whose memory follows `N` (#306; done on `v3`, with the 10M-fact acceptance tests moved from #473; spec `docs/superpowers/specs/2026-10-24-limit-order-by-design.md`). #641 targets v3.0.0 in three slices: snapshot-bound order proofs and Sort omission for committed scalar ranges, then one-group count/count-distinct and partition-at-a-time windows. The first slice is implemented on `v3`; aggregates and windows still buffer their full input pending the remaining slices. See `docs/superpowers/specs/2026-10-28-641-input-order-design.md`. - Fact-log iterator: `Minigraf::fact_log(&FactFilter)` streams every fact version (assertions and retractions, with `tx_count`, `tx_id` and valid-time bounds) in transaction order or storage order, filtered by attribute, attribute prefix, entity and tx range, with memory bounded by a window rather than the database (#430; Rust API done on `v3`). An open log pins its generation: checkpoints run but do not reuse its pages (#543; `API-013` deprecated). A raw log writer (#431) completes the extract-transform-load path; the binding objects follow with #462. - Read-only open: `OpenOptions::read_only` takes a shared lock, so several readers can hold a file at once, writes nothing to the file or its WAL (a WAL is applied in memory, a v7 file is read without migrating), and refuses writes with `API-014` (#429; Rust API done on `v3`). The bindings' `open_with_options` follows. - Raw log writer: `LogWriter` builds a new database from `FactRecord`s with their `tx_count`, `tx_id`, valid-time windows and assertion flags kept, gaps allowed (a purged transaction stays a hole for `:as-of`), at `.partial` renamed into place by `finish` (#431; Rust API done on `v3`). Completes extract (#429, #430), transform, load. The binding objects follow. diff --git a/benches/minigraf_bench.rs b/benches/minigraf_bench.rs index 35ac5a1021..411fa5b68f 100644 --- a/benches/minigraf_bench.rs +++ b/benches/minigraf_bench.rs @@ -234,6 +234,51 @@ fn bench_query(c: &mut Criterion) { // ── Task 6: time_travel/ ────────────────────────────────────────────────────── +// The existing nightly ^query/ filter selects both the proven value order and +// its UUID-tie fallback control. All facts are committed, not in-memory pending. +fn bench_input_order(c: &mut Criterion) { + let mut group = c.benchmark_group("query/ordered_values"); + group.sample_size(10); + for (label, n) in [ + ("1k", 1_000), + ("10k", 10_000), + ("100k", 100_000), + ("1m", 1_000_000), + ] { + for (mode, query) in [ + ( + "index", + "(query [:find ?v :where [?e :val ?v] :order-by [?v] :limit 10])", + ), + ( + "uuid_ties", + "(query [:find ?e ?v :where [?e :val ?v] :order-by [?v] :limit 10])", + ), + ] { + group.bench_with_input(BenchmarkId::new(mode, label), &n, |b, &n| { + let dir = tempfile::tempdir().unwrap(); + let path = dir.path().join("ordered.graph"); + helpers::populate_file(n, path.to_str().unwrap()); + let db = OpenOptions::new() + .read_only(true) + .path(&path) + .open() + .unwrap(); + b.iter(|| { + let minigraf::QueryResult::QueryResults { results, .. } = + db.execute(query).unwrap() + else { + panic!("expected rows"); + }; + assert_eq!(results.len(), 10.min(n)); + black_box(results) + }); + }); + } + } + group.finish(); +} + fn bench_time_travel(c: &mut Criterion) { const SCALES: &[(&str, usize)] = &[ ("1k", 1_000), @@ -1976,6 +2021,7 @@ criterion_group!( bench_insert, bench_insert_file, bench_query, + bench_input_order, bench_time_travel, bench_recursion, bench_negation, diff --git a/docs/BENCHMARKS.md b/docs/BENCHMARKS.md index c615ec9f16..313581d150 100644 --- a/docs/BENCHMARKS.md +++ b/docs/BENCHMARKS.md @@ -2,6 +2,127 @@ This document records reproducible local benchmark snapshots. Completed release-performance history belongs in the [CHANGELOG](../CHANGELOG.md); continuous CI history is available on [Bencher](https://bencher.dev/perf/minigraf/plots). +## Proven input order and Sort omission (#641, slice 1, unreleased) + +**Date**: 2026-10-28 · **Base**: `v3` at `2abf53df` · **Change**: #641, +first slice. The [build manifest](benchmarks/641-input-order-build.json) records +source, dependency-lock, library and probe fingerprints. Both libraries used +`--profile envelope` (opt-level 3) and `-C force-frame-pointers=yes`, with Rust +1.99.1 and the same dependency lock. + +Six rounds ran on an idle benchmark machine, binding CPU and memory to the same +NUMA node and swapping nodes and execution order between base and change each +round. Every query ran in a fresh process on a prebuilt, checkpointed file opened +read-only, on a 256 KiB worker stack. Three warmups preceded 5–20,000 measured +cursor drains within a one-second budget (at least five even for slower queries). +Open, fixture construction and profiling are outside timing. Tables give the +median of six process p50s; raw records retain each p50, its per-process range, +run count and query-only process peak RSS. No samples were discarded. + +The common envelope fixtures use `floor(N / 6)` ordinary entities and +approximately `N` currently visible facts, plus expired valid-time records and +hot-entity history. The +scale labels are nominal current-fact counts. The age queries read 16,666, +166,666 and 1,666,666 rows respectively. Every measured result checks its row +count; the ordered limit/offset probes also check that all returned ages are zero. + +| Nominal current facts | Ordered limit: base | Change | Ordered offset: base | Change | Change limit max peak RSS | +|---|---:|---:|---:|---:|---:| +| 100K | 5.996 ms | 0.458 ms | 6.022 ms | 0.457 ms | 3,784 KiB | +| 1M | 62.260 ms | 0.455 ms | 62.739 ms | 0.457 ms | 3,776 KiB | +| 10M | 643.947 ms | 0.463 ms | 644.929 ms | 0.452 ms | 3,796 KiB | + +The RSS column is the maximum of the six process peaks. + +The limit query is `[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]`; +the offset query adds `:offset 13`. At 10M, the changed p50 ranges were +0.459–0.476 ms and 0.448–0.459 ms. The 10M/100K ratios are **1.012** and **0.989**, +within the 2x gate. Peak RSS increases by **12 KiB** and **40 KiB**, within the +16 MiB allowance. Internal tests separately verify Sort omission, restored +projection slots, input read at most `offset + limit + 1,024` rows on the positive +fixture, at most eight raw kind-prefix seeks, and zero proof reads for zero limit +including a nonzero offset. + +### Startup cost on a selective ordered entity range + +The entity-and-attribute range remains EAVT. Its order proof still makes eight +whole-attribute kind-prefix seeks, whose startup cost dominates a one-row query: + +| Nominal current facts | Base | Change | +|---|---:|---:| +| 100K | 21.13 µs | 129.89 µs | +| 1M | 20.72 µs | 112.29 µs | +| 10M | 20.99 µs | 117.39 µs | + +Query: `[:find ?a :where [:pM :age ?a] :order-by [?a] :limit 1]`, where +`M = floor(entity_count / 2)`. This cost is reported separately from the ordinary +point-query guards. There is no cost-based selection or cross-query proof cache +in this slice. + +### Existing point and buffering controls + +The envelope's ordinary entity point, exact attribute/value point and current +hot-history point changed by **−0.65% to +1.03%** across the three scales. The +attribute scan, plain limit, ascending UUID-tie Sort and descending top-k control +changed by **−3.28% to +2.00%**. All measurements are in the +[360 envelope records](benchmarks/641-input-order.jsonl). + +The exact #323/#379 history fixture and four query shapes were also measured +through the same cursor probe: 2,000 filler facts, a never-changed sibling +attribute, and one live string value after `depth - 1` retract/reassert pairs. +The `:as-of 2002` query selects the first assertion with `:any-valid-time`. + +| Guard | Depth | Base p50 | Change p50 | Delta | +|---|---:|---:|---:|---:| +| Churned attribute | 1 | 16.83 µs | 16.70 µs | −0.80% | +| | 500 | 151.83 µs | 153.69 µs | +1.23% | +| | 2,000 | 602.70 µs | 599.46 µs | −0.54% | +| Sibling attribute | 1 | 17.12 µs | 17.10 µs | −0.15% | +| | 500 | 22.53 µs | 22.58 µs | +0.24% | +| | 2,000 | 22.85 µs | 22.81 µs | −0.17% | +| Attribute scan | 1 | 17.26 µs | 17.35 µs | +0.50% | +| | 500 | 152.62 µs | 152.65 µs | +0.02% | +| | 2,000 | 595.38 µs | 603.65 µs | +1.39% | +| Churned attribute, as-of | 1 | 17.85 µs | 17.76 µs | −0.48% | +| | 500 | 141.32 µs | 141.59 µs | +0.19% | +| | 2,000 | 554.11 µs | 560.41 µs | +1.14% | + +The worst guard delta is **+1.39%**, within the 5% gate. All +[144 history records](benchmarks/641-input-order-history.jsonl) are retained. + +### Reproduction and nightly routing + +Build the immutable base and the change once, then compile the same +[query probe](../scripts/input_order_probe.rs) against each library: + +```sh +RUSTFLAGS='-C force-frame-pointers=yes' cargo build --profile envelope --example perf_envelope +rustc --edition=2024 -C opt-level=3 -C panic=abort -C force-frame-pointers=yes \ + -L dependency="$target_dir/envelope/deps" \ + --extern minigraf="$target_dir/envelope/deps/libminigraf.rlib" \ + scripts/input_order_probe.rs -o "$probe_out" +``` + +Build envelope fixtures separately with `perf_envelope __build N`. +Run `probe '(query [...])' [zeros]` with alternating +CPU/memory binding as described above. Build the +[history fixture helper](../scripts/input_order_history_fixture.rs) against the +base library with the same rustc command; run it with ` `. +Raw records contain each complete query. + +All eight Criterion cases were executed on the bench with +`cargo bench --bench minigraf_bench -- '^query/ordered_values/' --test`: +`query/ordered_values/{index,uuid_ties}/{1k,10k,100k,1m}`. The existing `query` +nightly matrix uses `^query/`, which selects every new ID (#776); no workflow +change is needed. Scheduled Bencher history becomes available after merge. +`perf_envelope` also includes `ordered_values` beside its existing `top_k` control. + +The ordinary release binary is **1,254,928 bytes**, below the unchanged +**1,259,520-byte** cap (base: 1,258,784). Sharing the existing set/window sort +comparators removes duplicate generated code while preserving their order. +This slice changes Sort selection only; grouped Aggregate and Window remain +full-input operators until the following #641 slices. + ## Projected UUID lookup batching (#530, unreleased) **Date**: 2026-10-27 · **Baseline**: `v3` at `80120758` · **Change**: #530. diff --git a/docs/TEST_COVERAGE.md b/docs/TEST_COVERAGE.md index 7474084a85..ca8efca31f 100644 --- a/docs/TEST_COVERAGE.md +++ b/docs/TEST_COVERAGE.md @@ -4,11 +4,13 @@ | | Default features | With `--features test-hooks` | |---|---|---| -| **Passing** | 1,896 | 1,928 | +| **Passing** | 1,926 | 1,959 | | **Ignored** | 15 | 16 | -| **Total** | 1,911 | 1,944 | +| **Total** | 1,941 | 1,975 | -**Verified**: 2026-10-27 on the designated bench machine: the full default suite under branch coverage plus `cargo test --doc`, and `cargo test --features test-hooks`. The final review test enhancement also passed a focused dictionary rerun. All coverage gates retain their existing floors. +**Verified**: 2026-10-28 on the designated bench machine: the full default suite under branch coverage plus `cargo test --doc`, and `cargo test --features test-hooks`. The final proof-read failure enhancement also passed a focused rerun. All unchanged coverage floors pass; measured overall coverage is 95.39% lines and 86.14% branches. + +#641 adds 30 tests with default features and one more with `test-hooks`. #183 adds bounded row-frame parser, evaluator, and integration tests; one additional plan-independence case runs with `test-hooks`, including duplicate tie keys and NaN. A sliding-sum test checks recovery after integer saturation. Grammar corpus cases cover frame spellings and rejection. A meter test checks that a zero-width min frame reserves one deque slot. An ignored bench-machine diagnostic reproduces the Criterion datasets and prints the engine meter's peak for every measured case. @@ -24,6 +26,8 @@ Not counted above: the browser tests and the WASI run (see [Browser and WASI](#b ## Covered Areas +- **Proven input order** (#641, first slice; `src/query/engine/order_tests.rs`, `order/tests.rs`, `tests/input_order_test.rs`): full result keys and projection slots, constants and repeated slots, integer/Boolean/float edge cases including NaNs and signed zeros, replacements, join fallback orientation and distinct canonicalization. Snapshot tests cover unrelated versus in-range pending/staged records, captured prefixes, temporal filters, prepared queries, checkpoints and large-transaction working readers including rejected statements and rollback. Counters establish early stopping, bounded raw proof reads and no reads without demand; optional proof-read errors leave the original plan. Late callback and `collect-set` errors retain their evaluation. A forced-fallback differential matrix checks identical ordered lists across plan switches. A committed `MemoryBackend` fixture runs on native, WASI and the browser. Storage tests cover every key kind/tag and raw seeks over retracted history. + - **Bounded row frames** (`tests/window_functions_test.rs`, `src/query/datalog/aggregate/tests.rs`, #183): `:rows N preceding` parsing and errors, physical rows with tied order keys, partition reset, descending order, width zero and maximum, all five built-in aggregates against a replay oracle with numeric edge cases, UDFs through prepared queries and cursors, grouping with `:with`, distinct output, memory-limit refusal for long min/max strings, and final `:order-by` matching. A `test-hooks` case checks answer bags with clause reordering on and off. - **Optional distinct output** (`tests/distinct_test.rs`, #493): bag defaults, whole tuples, section syntax, cross-batch and committed/pending values, chunked write transactions, prepared execute/cursors, joins/rules/disjunction, aggregates and hidden `:with` groups, window peers and partitioned row numbers, temporal filters, typed equality and canonical float/set output, memory limits (including retained set payloads) and cursor cleanup. A meter unit test verifies each cell/key/value estimate includes set elements and their strings. With `test-hooks`, checks both reorder settings and hashed/correlated subplans. An engine unit test checks counters and state release. @@ -484,7 +488,8 @@ These tests compare the database against an independent answer rather than a sin None of these are counted in the summary. The wasm32 targets run in CI (`.github/workflows/wasm.yml`). -- **In a browser** (`wasm-pack test --headless`, Firefox and Chrome): 58 `wasm_bindgen_test` tests. +- **In a browser** (`wasm-pack test --headless`, Firefox and Chrome): 59 `wasm_bindgen_test` tests. The final #641 snapshot passed in headless Firefox on the bench; Chrome remains a CI run. + - One committed-memory-backend input-order fixture, including scalar edge cases and verification that Sort is omitted (#641). - Twenty-five for `BrowserDb`, including IndexedDB persistence, the cursor, and the flush returning every dirty page and failing on one it cannot read (#470). - Eleven for `BrowserBufferBackend` (which used `#[test]` and never ran before). - Two checking that IndexedDB page keys accept only whole numbers from 0 to 2^53. @@ -500,11 +505,11 @@ None of these are counted in the summary. The wasm32 targets run in CI (`.github - `importGraph()` deletes the replaced database's IndexedDB keys. - Two buffer tests check that releasing a page drops its bytes and any unflushed write, and that export writes a released page as zeros. - A native storage test checks that a file whose free pages are all zeros (as the browser exports them), both just migrated from v7 and after 20 saves, opens, verifies clean and keeps committing. The free-list test checks that a checkpoint reports exactly the ids it newly lists. -- **On `wasm32-wasip1` under Wasmtime**: the unit and integration tests that do not use a file run, 1,121 passing (`wasm.yml`, #746); ten that spawn threads or a child process are ignored on WASI. +- **On `wasm32-wasip1` under Wasmtime**: the unit and integration tests that do not use a file run, 1,177 passing and seven ignored in the 2026-10-28 bench run with Wasmtime v49.0.2 (`wasm.yml`). The committed input-order fixture runs here too, and the WASI REPL builds in release mode. ## Ignored Tests -The fourteen ignored tests (fifteen with `test-hooks`) are intentionally excluded from a normal local run: +The fifteen ignored tests (sixteen with `test-hooks`) are intentionally excluded from a normal local run: - Four rustdoc examples that reference internal types and cannot compile as standalone examples. - One high-contention concurrency stress test intended for scheduled runs. @@ -519,6 +524,7 @@ The fourteen ignored tests (fifteen with `test-hooks`) are intentionally exclude - One `:limit` and top-k acceptance test (`tests/limit_acceptance_test.rs`, #306, the #473 `:limit` item), run by the nightly smoke workflow over one 10M-fact fixture written with `LogWriter`: `:limit 10` returns 10 rows in under 250 ms under a 64 KiB `query_memory_limit`, adding under 32 MiB of peak RSS; `:order-by [?v :desc] :limit 10` returns the ten largest values under a 1 MiB limit, adding under 32 MiB. - One large-transaction acceptance test (`tests/large_transaction_acceptance_test.rs`, #550; `test-hooks` only), run by the nightly smoke workflow (see [Large transactions](#large-transactions-550)). - One measurement test (`meter_peak_against_rss`, `src/query/engine/tests.rs`, #549): prints the meter's peak against the peak RSS for the same two shapes, opening the engine directly. +- One row-frame measurement test (`window_rows_benchmark_meter_peaks`, `src/query/engine/tests.rs`, #183): prints metered peaks for the window benchmark fixtures. ## Reproducing diff --git a/docs/benchmarks/641-input-order-build.json b/docs/benchmarks/641-input-order-build.json new file mode 100644 index 0000000000..8b7b7510b6 --- /dev/null +++ b/docs/benchmarks/641-input-order-build.json @@ -0,0 +1,33 @@ +{ + "base": "2abf53df05447755490d017bc2daf89f4d59cdf5", + "pr_production_source_sha256": "a59a39766f2db679f231e22bd2a0290d687b7939470bcca0abbfa0d06c59bd15", + "probe_source_sha256": "103ea1adc656505c2c3c086c5747bbaf75e0a77bc283e60320030944bccf10f1", + "lock_sha256": "b03965119fd8ce5b5cf3ad3d37fb194ffeae24b6a862a0c85ae8fbcb6833ee77", + "compiler": "rustc 1.99.1 (58cf8f9c3 2026-10-13)", + "release_bytes": 1254928, + "nightly_filter": "^query/", + "executed_benchmark_ids": [ + "query/ordered_values/index/1k", + "query/ordered_values/index/10k", + "query/ordered_values/index/100k", + "query/ordered_values/index/1m", + "query/ordered_values/uuid_ties/1k", + "query/ordered_values/uuid_ties/10k", + "query/ordered_values/uuid_ties/100k", + "query/ordered_values/uuid_ties/1m" + ], + "libraries": { + "base": "dacde9faf1ede6e52c3bb6fc65bb7ba8e69b0ee907f0e6899ddf4fc3233a5b50", + "pr": "1ee5ddc54f1a08611a4f8e782eca79844f589c782114d11bcc1fa957abb5ee4d" + }, + "binaries": { + "base": "93bb52bbb3a058eed295710ea64b0c2a1496b031e714240777bf9e2420661780", + "pr": "29282193b4f9d9cc1066425dbcac3f16452b38de5a97c10b68dfa862fa0a9d98" + }, + "history_fixture_source_sha256": "faa6be9e273eedb9a12120cc1367369d2e662d71c8d92e333c15d0f1b3bcb92b", + "measurement_records": { + "envelope": 360, + "history_depth": 144, + "rounds": 6 + } +} diff --git a/docs/benchmarks/641-input-order-history.jsonl b/docs/benchmarks/641-input-order-history.jsonl new file mode 100644 index 0000000000..352435dfa5 --- /dev/null +++ b/docs/benchmarks/641-input-order-history.jsonl @@ -0,0 +1,144 @@ +{"round": 1, "variant": "base", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.906, "min_us": 16.468, "max_us": 82.443, "rows": 1, "peak_rss_kb": 3764} +{"round": 1, "variant": "pr", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.857, "min_us": 16.457, "max_us": 94.982, "rows": 1, "peak_rss_kb": 3800} +{"round": 1, "variant": "base", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.096, "min_us": 16.683, "max_us": 803.423, "rows": 1, "peak_rss_kb": 3764} +{"round": 1, "variant": "pr", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 16.835, "min_us": 16.412, "max_us": 90.514, "rows": 1, "peak_rss_kb": 3764} +{"round": 1, "variant": "base", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.46, "min_us": 16.94, "max_us": 79.938, "rows": 1, "peak_rss_kb": 3792} +{"round": 1, "variant": "pr", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.447, "min_us": 16.936, "max_us": 80.756, "rows": 1, "peak_rss_kb": 3852} +{"round": 1, "variant": "base", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 18.002, "min_us": 17.571, "max_us": 83.098, "rows": 1, "peak_rss_kb": 3796} +{"round": 1, "variant": "pr", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.739, "min_us": 17.27, "max_us": 75.076, "rows": 1, "peak_rss_kb": 3816} +{"round": 1, "variant": "base", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6340, "median_us": 152.142, "min_us": 149.835, "max_us": 2227.327, "rows": 1, "peak_rss_kb": 3720} +{"round": 1, "variant": "pr", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6321, "median_us": 153.786, "min_us": 150.602, "max_us": 499.42, "rows": 1, "peak_rss_kb": 3664} +{"round": 1, "variant": "base", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.544, "min_us": 22.151, "max_us": 78.273, "rows": 1, "peak_rss_kb": 3784} +{"round": 1, "variant": "pr", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.539, "min_us": 22.103, "max_us": 86.727, "rows": 1, "peak_rss_kb": 3776} +{"round": 1, "variant": "base", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6377, "median_us": 152.269, "min_us": 149.157, "max_us": 2210.9, "rows": 1, "peak_rss_kb": 3724} +{"round": 1, "variant": "pr", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6418, "median_us": 152.539, "min_us": 150.023, "max_us": 500.466, "rows": 1, "peak_rss_kb": 3688} +{"round": 1, "variant": "base", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6866, "median_us": 141.298, "min_us": 140.254, "max_us": 454.138, "rows": 1, "peak_rss_kb": 3688} +{"round": 1, "variant": "pr", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6838, "median_us": 142.273, "min_us": 140.08, "max_us": 1554.663, "rows": 1, "peak_rss_kb": 3668} +{"round": 1, "variant": "base", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1646, "median_us": 597.744, "min_us": 586.3, "max_us": 1860.558, "rows": 1, "peak_rss_kb": 3728} +{"round": 1, "variant": "pr", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1639, "median_us": 600.134, "min_us": 588.556, "max_us": 1880.08, "rows": 1, "peak_rss_kb": 3696} +{"round": 1, "variant": "base", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 23.568, "min_us": 22.947, "max_us": 145.107, "rows": 1, "peak_rss_kb": 3832} +{"round": 1, "variant": "pr", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.716, "min_us": 22.059, "max_us": 736.566, "rows": 1, "peak_rss_kb": 3824} +{"round": 1, "variant": "base", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1651, "median_us": 595.375, "min_us": 584.172, "max_us": 1877.677, "rows": 1, "peak_rss_kb": 3664} +{"round": 1, "variant": "pr", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1633, "median_us": 604.51, "min_us": 595.657, "max_us": 1888.71, "rows": 1, "peak_rss_kb": 3592} +{"round": 1, "variant": "base", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1748, "median_us": 553.95, "min_us": 543.607, "max_us": 11366.746, "rows": 1, "peak_rss_kb": 3684} +{"round": 1, "variant": "pr", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1766, "median_us": 556.9, "min_us": 546.422, "max_us": 1734.899, "rows": 1, "peak_rss_kb": 3696} +{"round": 2, "variant": "pr", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.675, "min_us": 16.305, "max_us": 76.262, "rows": 1, "peak_rss_kb": 3760} +{"round": 2, "variant": "base", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.891, "min_us": 16.449, "max_us": 71.06, "rows": 1, "peak_rss_kb": 3716} +{"round": 2, "variant": "pr", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.109, "min_us": 16.629, "max_us": 89.737, "rows": 1, "peak_rss_kb": 3788} +{"round": 2, "variant": "base", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.08, "min_us": 16.613, "max_us": 85.158, "rows": 1, "peak_rss_kb": 3824} +{"round": 2, "variant": "pr", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.788, "min_us": 17.177, "max_us": 748.357, "rows": 1, "peak_rss_kb": 3784} +{"round": 2, "variant": "base", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 16.905, "min_us": 16.556, "max_us": 87.255, "rows": 1, "peak_rss_kb": 3736} +{"round": 2, "variant": "pr", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 19.084, "min_us": 18.672, "max_us": 85.724, "rows": 1, "peak_rss_kb": 3756} +{"round": 2, "variant": "base", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.764, "min_us": 17.359, "max_us": 83.609, "rows": 1, "peak_rss_kb": 3816} +{"round": 2, "variant": "pr", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6366, "median_us": 153.598, "min_us": 152.181, "max_us": 491.288, "rows": 1, "peak_rss_kb": 3724} +{"round": 2, "variant": "base", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6357, "median_us": 153.085, "min_us": 150.472, "max_us": 2196.376, "rows": 1, "peak_rss_kb": 3720} +{"round": 2, "variant": "pr", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.386, "min_us": 21.828, "max_us": 112.221, "rows": 1, "peak_rss_kb": 3740} +{"round": 2, "variant": "base", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.596, "min_us": 22.154, "max_us": 93.266, "rows": 1, "peak_rss_kb": 3824} +{"round": 2, "variant": "pr", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6450, "median_us": 151.279, "min_us": 149.371, "max_us": 502.608, "rows": 1, "peak_rss_kb": 3676} +{"round": 2, "variant": "base", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6300, "median_us": 154.965, "min_us": 150.329, "max_us": 2195.723, "rows": 1, "peak_rss_kb": 3716} +{"round": 2, "variant": "pr", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6891, "median_us": 141.48, "min_us": 139.929, "max_us": 461.349, "rows": 1, "peak_rss_kb": 3676} +{"round": 2, "variant": "base", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6928, "median_us": 141.302, "min_us": 140.238, "max_us": 455.611, "rows": 1, "peak_rss_kb": 3700} +{"round": 2, "variant": "pr", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1631, "median_us": 598.787, "min_us": 588.113, "max_us": 5609.805, "rows": 1, "peak_rss_kb": 3640} +{"round": 2, "variant": "base", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1639, "median_us": 597.491, "min_us": 585.913, "max_us": 1867.888, "rows": 1, "peak_rss_kb": 3716} +{"round": 2, "variant": "pr", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 23.082, "min_us": 22.52, "max_us": 95.217, "rows": 1, "peak_rss_kb": 3804} +{"round": 2, "variant": "base", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.885, "min_us": 22.331, "max_us": 92.149, "rows": 1, "peak_rss_kb": 3784} +{"round": 2, "variant": "pr", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1624, "median_us": 603.779, "min_us": 586.896, "max_us": 5550.759, "rows": 1, "peak_rss_kb": 3700} +{"round": 2, "variant": "base", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1652, "median_us": 595.145, "min_us": 582.785, "max_us": 1880.313, "rows": 1, "peak_rss_kb": 3712} +{"round": 2, "variant": "pr", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1774, "median_us": 560.957, "min_us": 551.77, "max_us": 743.736, "rows": 1, "peak_rss_kb": 3772} +{"round": 2, "variant": "base", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1728, "median_us": 562.679, "min_us": 545.296, "max_us": 4702.014, "rows": 1, "peak_rss_kb": 3704} +{"round": 3, "variant": "base", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.734, "min_us": 16.298, "max_us": 74.254, "rows": 1, "peak_rss_kb": 3720} +{"round": 3, "variant": "pr", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.722, "min_us": 16.381, "max_us": 68.361, "rows": 1, "peak_rss_kb": 3776} +{"round": 3, "variant": "base", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.162, "min_us": 16.705, "max_us": 69.66, "rows": 1, "peak_rss_kb": 3784} +{"round": 3, "variant": "pr", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.218, "min_us": 16.79, "max_us": 79.269, "rows": 1, "peak_rss_kb": 3760} +{"round": 3, "variant": "base", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 18.048, "min_us": 17.562, "max_us": 94.161, "rows": 1, "peak_rss_kb": 3808} +{"round": 3, "variant": "pr", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.289, "min_us": 16.772, "max_us": 75.611, "rows": 1, "peak_rss_kb": 3768} +{"round": 3, "variant": "base", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 18.68, "min_us": 18.272, "max_us": 81.33, "rows": 1, "peak_rss_kb": 3712} +{"round": 3, "variant": "pr", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.783, "min_us": 17.22, "max_us": 707.082, "rows": 1, "peak_rss_kb": 3784} +{"round": 3, "variant": "base", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6430, "median_us": 151.518, "min_us": 149.956, "max_us": 497.927, "rows": 1, "peak_rss_kb": 3624} +{"round": 3, "variant": "pr", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6389, "median_us": 153.512, "min_us": 150.715, "max_us": 492.043, "rows": 1, "peak_rss_kb": 3712} +{"round": 3, "variant": "base", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.508, "min_us": 22.008, "max_us": 96.071, "rows": 1, "peak_rss_kb": 3800} +{"round": 3, "variant": "pr", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.587, "min_us": 22.008, "max_us": 726.64, "rows": 1, "peak_rss_kb": 3796} +{"round": 3, "variant": "base", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6381, "median_us": 152.566, "min_us": 149.858, "max_us": 496.243, "rows": 1, "peak_rss_kb": 3684} +{"round": 3, "variant": "pr", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6401, "median_us": 153.118, "min_us": 149.871, "max_us": 509.491, "rows": 1, "peak_rss_kb": 3680} +{"round": 3, "variant": "base", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6753, "median_us": 141.804, "min_us": 139.436, "max_us": 8926.202, "rows": 1, "peak_rss_kb": 3620} +{"round": 3, "variant": "pr", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6901, "median_us": 141.333, "min_us": 140.16, "max_us": 457.275, "rows": 1, "peak_rss_kb": 3692} +{"round": 3, "variant": "base", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1641, "median_us": 602.906, "min_us": 593.64, "max_us": 1863.624, "rows": 1, "peak_rss_kb": 3724} +{"round": 3, "variant": "pr", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1614, "median_us": 604.969, "min_us": 589.561, "max_us": 4688.369, "rows": 1, "peak_rss_kb": 3728} +{"round": 3, "variant": "base", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.768, "min_us": 22.146, "max_us": 114.388, "rows": 1, "peak_rss_kb": 3836} +{"round": 3, "variant": "pr", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.818, "min_us": 22.23, "max_us": 101.942, "rows": 1, "peak_rss_kb": 3796} +{"round": 3, "variant": "base", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1666, "median_us": 595.394, "min_us": 583.836, "max_us": 787.021, "rows": 1, "peak_rss_kb": 3668} +{"round": 3, "variant": "pr", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1624, "median_us": 603.515, "min_us": 586.108, "max_us": 4651.353, "rows": 1, "peak_rss_kb": 3680} +{"round": 3, "variant": "base", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1753, "median_us": 553.817, "min_us": 544.568, "max_us": 1730.679, "rows": 1, "peak_rss_kb": 3716} +{"round": 3, "variant": "pr", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1751, "median_us": 561.46, "min_us": 552.549, "max_us": 1754.141, "rows": 1, "peak_rss_kb": 3680} +{"round": 4, "variant": "pr", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.629, "min_us": 16.17, "max_us": 95.032, "rows": 1, "peak_rss_kb": 3756} +{"round": 4, "variant": "base", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.76, "min_us": 16.323, "max_us": 74.642, "rows": 1, "peak_rss_kb": 3772} +{"round": 4, "variant": "pr", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 16.77, "min_us": 16.403, "max_us": 864.789, "rows": 1, "peak_rss_kb": 3820} +{"round": 4, "variant": "base", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 16.747, "min_us": 16.369, "max_us": 74.181, "rows": 1, "peak_rss_kb": 3800} +{"round": 4, "variant": "pr", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.408, "min_us": 16.983, "max_us": 75.156, "rows": 1, "peak_rss_kb": 3696} +{"round": 4, "variant": "base", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.253, "min_us": 16.825, "max_us": 78.374, "rows": 1, "peak_rss_kb": 3792} +{"round": 4, "variant": "pr", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.464, "min_us": 17.1, "max_us": 83.229, "rows": 1, "peak_rss_kb": 3800} +{"round": 4, "variant": "base", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.726, "min_us": 17.334, "max_us": 73.666, "rows": 1, "peak_rss_kb": 3760} +{"round": 4, "variant": "pr", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6317, "median_us": 153.855, "min_us": 151.147, "max_us": 1604.284, "rows": 1, "peak_rss_kb": 3676} +{"round": 4, "variant": "base", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6442, "median_us": 151.501, "min_us": 149.554, "max_us": 495.611, "rows": 1, "peak_rss_kb": 3700} +{"round": 4, "variant": "pr", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.741, "min_us": 22.357, "max_us": 105.216, "rows": 1, "peak_rss_kb": 3780} +{"round": 4, "variant": "base", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.33, "min_us": 21.96, "max_us": 98.274, "rows": 1, "peak_rss_kb": 3788} +{"round": 4, "variant": "pr", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6317, "median_us": 153.921, "min_us": 150.851, "max_us": 2857.311, "rows": 1, "peak_rss_kb": 3736} +{"round": 4, "variant": "base", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6434, "median_us": 151.994, "min_us": 149.69, "max_us": 500.312, "rows": 1, "peak_rss_kb": 3660} +{"round": 4, "variant": "pr", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6910, "median_us": 141.128, "min_us": 139.965, "max_us": 492.855, "rows": 1, "peak_rss_kb": 3684} +{"round": 4, "variant": "base", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6863, "median_us": 141.344, "min_us": 139.443, "max_us": 2249.052, "rows": 1, "peak_rss_kb": 3728} +{"round": 4, "variant": "pr", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1637, "median_us": 600.294, "min_us": 589.931, "max_us": 1881.724, "rows": 1, "peak_rss_kb": 3692} +{"round": 4, "variant": "base", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1624, "median_us": 603.857, "min_us": 593.953, "max_us": 1881.193, "rows": 1, "peak_rss_kb": 3720} +{"round": 4, "variant": "pr", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.747, "min_us": 22.116, "max_us": 104.102, "rows": 1, "peak_rss_kb": 3780} +{"round": 4, "variant": "base", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 23.154, "min_us": 22.47, "max_us": 875.121, "rows": 1, "peak_rss_kb": 3732} +{"round": 4, "variant": "pr", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1650, "median_us": 594.634, "min_us": 585.981, "max_us": 1899.084, "rows": 1, "peak_rss_kb": 3680} +{"round": 4, "variant": "base", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1637, "median_us": 601.359, "min_us": 591.949, "max_us": 1871.951, "rows": 1, "peak_rss_kb": 3668} +{"round": 4, "variant": "pr", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1745, "median_us": 561.747, "min_us": 550.313, "max_us": 5195.283, "rows": 1, "peak_rss_kb": 3700} +{"round": 4, "variant": "base", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1772, "median_us": 553.247, "min_us": 543.55, "max_us": 1734.786, "rows": 1, "peak_rss_kb": 3708} +{"round": 5, "variant": "base", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.998, "min_us": 16.612, "max_us": 75.232, "rows": 1, "peak_rss_kb": 3764} +{"round": 5, "variant": "pr", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.85, "min_us": 16.377, "max_us": 69.997, "rows": 1, "peak_rss_kb": 3816} +{"round": 5, "variant": "base", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.309, "min_us": 16.912, "max_us": 78.548, "rows": 1, "peak_rss_kb": 3792} +{"round": 5, "variant": "pr", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.244, "min_us": 16.696, "max_us": 74.401, "rows": 1, "peak_rss_kb": 3860} +{"round": 5, "variant": "base", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.13, "min_us": 16.615, "max_us": 144.4, "rows": 1, "peak_rss_kb": 3736} +{"round": 5, "variant": "pr", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.16, "min_us": 16.706, "max_us": 14797.176, "rows": 1, "peak_rss_kb": 3700} +{"round": 5, "variant": "base", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.936, "min_us": 17.463, "max_us": 59.231, "rows": 1, "peak_rss_kb": 3804} +{"round": 5, "variant": "pr", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.746, "min_us": 17.233, "max_us": 95.154, "rows": 1, "peak_rss_kb": 3804} +{"round": 5, "variant": "base", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6441, "median_us": 151.521, "min_us": 150.145, "max_us": 492.034, "rows": 1, "peak_rss_kb": 3692} +{"round": 5, "variant": "pr", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6273, "median_us": 156.063, "min_us": 154.656, "max_us": 515.124, "rows": 1, "peak_rss_kb": 3692} +{"round": 5, "variant": "base", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.641, "min_us": 22.229, "max_us": 781.177, "rows": 1, "peak_rss_kb": 3828} +{"round": 5, "variant": "pr", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.573, "min_us": 22.199, "max_us": 54.21, "rows": 1, "peak_rss_kb": 3792} +{"round": 5, "variant": "base", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6258, "median_us": 154.637, "min_us": 151.822, "max_us": 498.037, "rows": 1, "peak_rss_kb": 3684} +{"round": 5, "variant": "pr", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6448, "median_us": 151.387, "min_us": 149.652, "max_us": 525.652, "rows": 1, "peak_rss_kb": 3684} +{"round": 5, "variant": "base", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6867, "median_us": 140.57, "min_us": 139.584, "max_us": 1533.466, "rows": 1, "peak_rss_kb": 3708} +{"round": 5, "variant": "pr", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6860, "median_us": 142.649, "min_us": 141.554, "max_us": 463.5, "rows": 1, "peak_rss_kb": 3664} +{"round": 5, "variant": "base", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1639, "median_us": 603.206, "min_us": 594.668, "max_us": 1861.797, "rows": 1, "peak_rss_kb": 3724} +{"round": 5, "variant": "pr", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1646, "median_us": 597.229, "min_us": 588.674, "max_us": 4242.573, "rows": 1, "peak_rss_kb": 3652} +{"round": 5, "variant": "base", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.668, "min_us": 22.101, "max_us": 91.371, "rows": 1, "peak_rss_kb": 3836} +{"round": 5, "variant": "pr", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 23.03, "min_us": 22.46, "max_us": 100.766, "rows": 1, "peak_rss_kb": 3800} +{"round": 5, "variant": "base", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1642, "median_us": 601.674, "min_us": 592.758, "max_us": 1873.812, "rows": 1, "peak_rss_kb": 3720} +{"round": 5, "variant": "pr", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1632, "median_us": 596.197, "min_us": 585.945, "max_us": 5471.409, "rows": 1, "peak_rss_kb": 3684} +{"round": 5, "variant": "base", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1772, "median_us": 554.277, "min_us": 544.99, "max_us": 1735.434, "rows": 1, "peak_rss_kb": 3684} +{"round": 5, "variant": "pr", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1753, "median_us": 559.87, "min_us": 547.699, "max_us": 1737.856, "rows": 1, "peak_rss_kb": 3676} +{"round": 6, "variant": "pr", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.443, "min_us": 16.116, "max_us": 741.735, "rows": 1, "peak_rss_kb": 3772} +{"round": 6, "variant": "base", "depth": 1, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 16.774, "min_us": 16.313, "max_us": 72.202, "rows": 1, "peak_rss_kb": 3760} +{"round": 6, "variant": "pr", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.081, "min_us": 16.704, "max_us": 79.151, "rows": 1, "peak_rss_kb": 3812} +{"round": 6, "variant": "base", "depth": 1, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 17.146, "min_us": 16.771, "max_us": 91.307, "rows": 1, "peak_rss_kb": 3800} +{"round": 6, "variant": "pr", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.273, "min_us": 16.798, "max_us": 97.071, "rows": 1, "peak_rss_kb": 3856} +{"round": 6, "variant": "base", "depth": 1, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 20000, "median_us": 17.271, "min_us": 16.704, "max_us": 74.07, "rows": 1, "peak_rss_kb": 3772} +{"round": 6, "variant": "pr", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 18.364, "min_us": 17.893, "max_us": 80.395, "rows": 1, "peak_rss_kb": 3808} +{"round": 6, "variant": "base", "depth": 1, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 20000, "median_us": 17.715, "min_us": 17.224, "max_us": 89.931, "rows": 1, "peak_rss_kb": 3708} +{"round": 6, "variant": "pr", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6401, "median_us": 151.754, "min_us": 150.403, "max_us": 1616.608, "rows": 1, "peak_rss_kb": 3692} +{"round": 6, "variant": "base", "depth": 500, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 6394, "median_us": 153.143, "min_us": 151.561, "max_us": 510.87, "rows": 1, "peak_rss_kb": 3700} +{"round": 6, "variant": "pr", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.688, "min_us": 22.29, "max_us": 93.783, "rows": 1, "peak_rss_kb": 3824} +{"round": 6, "variant": "base", "depth": 500, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.348, "min_us": 21.955, "max_us": 94.307, "rows": 1, "peak_rss_kb": 3836} +{"round": 6, "variant": "pr", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6342, "median_us": 152.764, "min_us": 150.451, "max_us": 1661.674, "rows": 1, "peak_rss_kb": 3668} +{"round": 6, "variant": "base", "depth": 500, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 6422, "median_us": 152.679, "min_us": 149.214, "max_us": 514.372, "rows": 1, "peak_rss_kb": 3664} +{"round": 6, "variant": "pr", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6986, "median_us": 141.704, "min_us": 140.62, "max_us": 209.368, "rows": 1, "peak_rss_kb": 3684} +{"round": 6, "variant": "base", "depth": 500, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 6710, "median_us": 145.295, "min_us": 139.236, "max_us": 1545.012, "rows": 1, "peak_rss_kb": 3708} +{"round": 6, "variant": "pr", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1641, "median_us": 597.678, "min_us": 587.99, "max_us": 1878.505, "rows": 1, "peak_rss_kb": 3676} +{"round": 6, "variant": "base", "depth": 2000, "workload": "churned_attr", "query": "(query [:find ?v :where [:e/hot :hash ?v]])", "runs": 1635, "median_us": 602.497, "min_us": 593.95, "max_us": 1866.401, "rows": 1, "peak_rss_kb": 3700} +{"round": 6, "variant": "pr", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.806, "min_us": 22.249, "max_us": 20032.575, "rows": 1, "peak_rss_kb": 3788} +{"round": 6, "variant": "base", "depth": 2000, "workload": "sibling_attr", "query": "(query [:find ?v :where [:e/hot :other ?v]])", "runs": 20000, "median_us": 22.816, "min_us": 22.25, "max_us": 96.466, "rows": 1, "peak_rss_kb": 3780} +{"round": 6, "variant": "pr", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1633, "median_us": 604.199, "min_us": 595.755, "max_us": 1900.908, "rows": 1, "peak_rss_kb": 3680} +{"round": 6, "variant": "base", "depth": 2000, "workload": "attr_scan", "query": "(query [:find ?v :where [?e :hash ?v]])", "runs": 1661, "median_us": 592.368, "min_us": 582.486, "max_us": 1890.818, "rows": 1, "peak_rss_kb": 3720} +{"round": 6, "variant": "pr", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1747, "median_us": 557.233, "min_us": 547.646, "max_us": 5907.174, "rows": 1, "peak_rss_kb": 3716} +{"round": 6, "variant": "base", "depth": 2000, "workload": "churned_attr_as_of", "query": "(query [:find ?v :as-of 2002 :valid-at :any-valid-time :where [:e/hot :hash ?v]])", "runs": 1760, "median_us": 558.291, "min_us": 549.587, "max_us": 1726.513, "rows": 1, "peak_rss_kb": 3716} diff --git a/docs/benchmarks/641-input-order.jsonl b/docs/benchmarks/641-input-order.jsonl new file mode 100644 index 0000000000..baa1fe86a6 --- /dev/null +++ b/docs/benchmarks/641-input-order.jsonl @@ -0,0 +1,360 @@ +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 166, "median_us": 5999.528, "min_us": 5911.703, "max_us": 13178.963, "rows": 10, "peak_rss_kb": 4176} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2143, "median_us": 460.741, "min_us": 444.309, "max_us": 1450.36, "rows": 10, "peak_rss_kb": 3784} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 166, "median_us": 6019.166, "min_us": 5967.508, "max_us": 6656.385, "rows": 10, "peak_rss_kb": 4180} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2176, "median_us": 454.606, "min_us": 439.851, "max_us": 3984.18, "rows": 10, "peak_rss_kb": 3748} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.812, "min_us": 20.224, "max_us": 88.481, "rows": 1, "peak_rss_kb": 3808} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 7554, "median_us": 129.307, "min_us": 127.898, "max_us": 424.464, "rows": 1, "peak_rss_kb": 3736} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.573, "min_us": 18.044, "max_us": 85.216, "rows": 1, "peak_rss_kb": 3772} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 19.327, "min_us": 18.531, "max_us": 106.444, "rows": 1, "peak_rss_kb": 3812} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.135, "min_us": 18.619, "max_us": 779.875, "rows": 1, "peak_rss_kb": 3816} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.374, "min_us": 18.901, "max_us": 95.784, "rows": 1, "peak_rss_kb": 3828} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3044, "median_us": 322.928, "min_us": 319.465, "max_us": 1037.887, "rows": 1, "peak_rss_kb": 3672} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3038, "median_us": 323.932, "min_us": 316.45, "max_us": 1023.898, "rows": 1, "peak_rss_kb": 3656} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 74, "median_us": 13412.638, "min_us": 13276.464, "max_us": 20846.811, "rows": 16666, "peak_rss_kb": 4944} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 75, "median_us": 13453.5, "min_us": 13415.17, "max_us": 13715.365, "rows": 16666, "peak_rss_kb": 4936} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2716, "median_us": 364.816, "min_us": 348.679, "max_us": 1157.841, "rows": 10, "peak_rss_kb": 3740} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2654, "median_us": 365.592, "min_us": 350.656, "max_us": 3883.688, "rows": 10, "peak_rss_kb": 3780} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25524.469, "min_us": 25301.531, "max_us": 25765.421, "rows": 10, "peak_rss_kb": 4832} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25472.541, "min_us": 25309.818, "max_us": 25704.93, "rows": 10, "peak_rss_kb": 4736} +{"round": 1, "variant": "base", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 39, "median_us": 25499.927, "min_us": 25391.607, "max_us": 33072.375, "rows": 10, "peak_rss_kb": 4832} +{"round": 1, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25548.462, "min_us": 25385.514, "max_us": 25938.541, "rows": 10, "peak_rss_kb": 4792} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 16, "median_us": 62281.778, "min_us": 61935.259, "max_us": 71065.572, "rows": 10, "peak_rss_kb": 4880} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2161, "median_us": 455.524, "min_us": 445.803, "max_us": 1459.113, "rows": 10, "peak_rss_kb": 3736} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 16, "median_us": 62969.124, "min_us": 62224.344, "max_us": 70317.947, "rows": 10, "peak_rss_kb": 4856} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2110, "median_us": 453.91, "min_us": 444.449, "max_us": 11753.514, "rows": 10, "peak_rss_kb": 3732} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.572, "min_us": 20.1, "max_us": 127.318, "rows": 1, "peak_rss_kb": 3820} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 8701, "median_us": 112.338, "min_us": 111.524, "max_us": 396.602, "rows": 1, "peak_rss_kb": 3756} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.668, "min_us": 18.216, "max_us": 87.411, "rows": 1, "peak_rss_kb": 3780} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.801, "min_us": 18.257, "max_us": 100.848, "rows": 1, "peak_rss_kb": 3772} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 18.073, "min_us": 16.817, "max_us": 715.39, "rows": 1, "peak_rss_kb": 3784} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 18.199, "min_us": 17.231, "max_us": 83.215, "rows": 1, "peak_rss_kb": 3828} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3060, "median_us": 322.086, "min_us": 317.623, "max_us": 1011.017, "rows": 1, "peak_rss_kb": 3668} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3026, "median_us": 325.133, "min_us": 320.272, "max_us": 1034.703, "rows": 1, "peak_rss_kb": 3704} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 139741.241, "min_us": 138656.25, "max_us": 140523.233, "rows": 166666, "peak_rss_kb": 5248} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 141550.061, "min_us": 140984.143, "max_us": 141976.96, "rows": 166666, "peak_rss_kb": 5288} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2581, "median_us": 376.194, "min_us": 369.579, "max_us": 3833.53, "rows": 10, "peak_rss_kb": 3792} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2743, "median_us": 354.296, "min_us": 342.685, "max_us": 1253.85, "rows": 10, "peak_rss_kb": 3712} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 267968.931, "min_us": 264570.967, "max_us": 282735.78, "rows": 10, "peak_rss_kb": 5032} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 267744.457, "min_us": 266299.304, "max_us": 279455.065, "rows": 10, "peak_rss_kb": 4952} +{"round": 1, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 268195.422, "min_us": 265135.622, "max_us": 280573.941, "rows": 10, "peak_rss_kb": 5012} +{"round": 1, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 270443.137, "min_us": 269416.964, "max_us": 273004.923, "rows": 10, "peak_rss_kb": 5000} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 637108.3, "min_us": 632771.696, "max_us": 646132.306, "rows": 10, "peak_rss_kb": 4836} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2135, "median_us": 461.927, "min_us": 453.211, "max_us": 1484.828, "rows": 10, "peak_rss_kb": 3748} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 5, "median_us": 635174.048, "min_us": 632851.087, "max_us": 643959.311, "rows": 10, "peak_rss_kb": 4916} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2207, "median_us": 450.251, "min_us": 426.854, "max_us": 1433.093, "rows": 10, "peak_rss_kb": 3808} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 21.162, "min_us": 20.568, "max_us": 108.788, "rows": 1, "peak_rss_kb": 3816} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 8208, "median_us": 117.65, "min_us": 113.878, "max_us": 2155.73, "rows": 1, "peak_rss_kb": 3668} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.924, "min_us": 18.397, "max_us": 110.716, "rows": 1, "peak_rss_kb": 3832} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.947, "min_us": 18.382, "max_us": 90.96, "rows": 1, "peak_rss_kb": 3840} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 18.015, "min_us": 17.188, "max_us": 74.388, "rows": 1, "peak_rss_kb": 3804} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 17.845, "min_us": 17.057, "max_us": 77.678, "rows": 1, "peak_rss_kb": 3880} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3050, "median_us": 321.506, "min_us": 316.367, "max_us": 1019.674, "rows": 1, "peak_rss_kb": 3700} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3027, "median_us": 321.409, "min_us": 316.463, "max_us": 3721.594, "rows": 1, "peak_rss_kb": 3680} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1410535.452, "min_us": 1391930.733, "max_us": 1435272.787, "rows": 1666666, "peak_rss_kb": 5376} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1458299.471, "min_us": 1450210.999, "max_us": 1492299.323, "rows": 1666666, "peak_rss_kb": 5372} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2667, "median_us": 364.733, "min_us": 347.843, "max_us": 4598.292, "rows": 10, "peak_rss_kb": 3760} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2651, "median_us": 370.362, "min_us": 355.885, "max_us": 1170.554, "rows": 10, "peak_rss_kb": 3728} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2793647.54, "min_us": 2773543.313, "max_us": 2816038.345, "rows": 10, "peak_rss_kb": 4996} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2825120.322, "min_us": 2815575.789, "max_us": 2839506.802, "rows": 10, "peak_rss_kb": 4928} +{"round": 1, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2803596.412, "min_us": 2741740.527, "max_us": 2822248.952, "rows": 10, "peak_rss_kb": 5016} +{"round": 1, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2831466.154, "min_us": 2815023.238, "max_us": 2835387.533, "rows": 10, "peak_rss_kb": 5076} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2150, "median_us": 457.646, "min_us": 445.785, "max_us": 1440.895, "rows": 10, "peak_rss_kb": 3752} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 165, "median_us": 6011.734, "min_us": 5937.178, "max_us": 13423.5, "rows": 10, "peak_rss_kb": 4188} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2137, "median_us": 459.538, "min_us": 446.25, "max_us": 1442.254, "rows": 10, "peak_rss_kb": 3700} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 166, "median_us": 6020.646, "min_us": 5920.936, "max_us": 7494.722, "rows": 10, "peak_rss_kb": 4168} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 7487, "median_us": 130.159, "min_us": 128.581, "max_us": 1643.117, "rows": 1, "peak_rss_kb": 3692} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 23.709, "min_us": 22.738, "max_us": 113.772, "rows": 1, "peak_rss_kb": 3776} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 19.258, "min_us": 18.654, "max_us": 79.98, "rows": 1, "peak_rss_kb": 3800} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 19.801, "min_us": 19.151, "max_us": 85.3, "rows": 1, "peak_rss_kb": 3816} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 18.972, "min_us": 18.489, "max_us": 87.318, "rows": 1, "peak_rss_kb": 3728} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.046, "min_us": 18.588, "max_us": 88.15, "rows": 1, "peak_rss_kb": 3800} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3009, "median_us": 324.773, "min_us": 317.32, "max_us": 3060.825, "rows": 1, "peak_rss_kb": 3708} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3089, "median_us": 318.473, "min_us": 314.95, "max_us": 1063.898, "rows": 1, "peak_rss_kb": 3688} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 74, "median_us": 13598.123, "min_us": 13396.361, "max_us": 15698.865, "rows": 16666, "peak_rss_kb": 4940} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 71, "median_us": 13328.041, "min_us": 13283.66, "max_us": 65722.236, "rows": 16666, "peak_rss_kb": 4908} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2658, "median_us": 369.959, "min_us": 358.074, "max_us": 1197.642, "rows": 10, "peak_rss_kb": 3864} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2744, "median_us": 360.229, "min_us": 345.243, "max_us": 1172.814, "rows": 10, "peak_rss_kb": 3784} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 39, "median_us": 25472.288, "min_us": 25261.457, "max_us": 33253.776, "rows": 10, "peak_rss_kb": 4832} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 39, "median_us": 25602.618, "min_us": 25424.693, "max_us": 27090.33, "rows": 10, "peak_rss_kb": 4824} +{"round": 2, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25383.677, "min_us": 25264.427, "max_us": 29115.778, "rows": 10, "peak_rss_kb": 4808} +{"round": 2, "variant": "base", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25362.803, "min_us": 25253.247, "max_us": 33726.947, "rows": 10, "peak_rss_kb": 4808} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2155, "median_us": 456.641, "min_us": 448.256, "max_us": 1444.153, "rows": 10, "peak_rss_kb": 3700} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 16, "median_us": 64563.716, "min_us": 64343.98, "max_us": 73281.349, "rows": 10, "peak_rss_kb": 4860} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2141, "median_us": 458.162, "min_us": 451.952, "max_us": 1454.791, "rows": 10, "peak_rss_kb": 3716} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 16, "median_us": 62813.637, "min_us": 62262.455, "max_us": 65004.883, "rows": 10, "peak_rss_kb": 4876} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 8634, "median_us": 112.042, "min_us": 111.079, "max_us": 1497.188, "rows": 1, "peak_rss_kb": 3708} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.93, "min_us": 20.51, "max_us": 93.378, "rows": 1, "peak_rss_kb": 3812} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 19.007, "min_us": 18.565, "max_us": 94.512, "rows": 1, "peak_rss_kb": 3780} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.993, "min_us": 18.469, "max_us": 104.859, "rows": 1, "peak_rss_kb": 3772} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 17.869, "min_us": 16.819, "max_us": 83.409, "rows": 1, "peak_rss_kb": 3732} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 18.763, "min_us": 17.814, "max_us": 81.775, "rows": 1, "peak_rss_kb": 3792} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3009, "median_us": 323.358, "min_us": 315.108, "max_us": 3752.876, "rows": 1, "peak_rss_kb": 3704} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3066, "median_us": 320.323, "min_us": 312.961, "max_us": 1014.121, "rows": 1, "peak_rss_kb": 3656} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 139268.148, "min_us": 138356.708, "max_us": 139742.486, "rows": 166666, "peak_rss_kb": 5312} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 139354.681, "min_us": 139052.022, "max_us": 139927.452, "rows": 166666, "peak_rss_kb": 5300} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2698, "median_us": 361.642, "min_us": 347.237, "max_us": 1194.932, "rows": 10, "peak_rss_kb": 3820} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2587, "median_us": 376.483, "min_us": 367.925, "max_us": 4501.921, "rows": 10, "peak_rss_kb": 3788} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 270440.524, "min_us": 267778.725, "max_us": 271862.69, "rows": 10, "peak_rss_kb": 5032} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 270863.746, "min_us": 269732.35, "max_us": 272756.709, "rows": 10, "peak_rss_kb": 4988} +{"round": 2, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 268604.568, "min_us": 268322.147, "max_us": 319852.46, "rows": 10, "peak_rss_kb": 5060} +{"round": 2, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 267559.016, "min_us": 266048.641, "max_us": 278298.904, "rows": 10, "peak_rss_kb": 5004} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2118, "median_us": 463.954, "min_us": 452.226, "max_us": 1499.976, "rows": 10, "peak_rss_kb": 3700} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 650786.529, "min_us": 648681.037, "max_us": 658560.777, "rows": 10, "peak_rss_kb": 4900} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2176, "median_us": 458.669, "min_us": 431.312, "max_us": 1409.959, "rows": 10, "peak_rss_kb": 3752} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 5, "median_us": 656929.758, "min_us": 655165.105, "max_us": 663975.921, "rows": 10, "peak_rss_kb": 4952} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 8306, "median_us": 117.169, "min_us": 113.863, "max_us": 380.752, "rows": 1, "peak_rss_kb": 3752} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.836, "min_us": 20.224, "max_us": 86.349, "rows": 1, "peak_rss_kb": 3768} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 19.114, "min_us": 18.468, "max_us": 86.636, "rows": 1, "peak_rss_kb": 3736} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.78, "min_us": 18.205, "max_us": 84.338, "rows": 1, "peak_rss_kb": 3796} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 17.527, "min_us": 16.798, "max_us": 742.505, "rows": 1, "peak_rss_kb": 3728} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 18.035, "min_us": 17.266, "max_us": 78.46, "rows": 1, "peak_rss_kb": 3816} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3005, "median_us": 327.174, "min_us": 317.702, "max_us": 1049.976, "rows": 1, "peak_rss_kb": 3756} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3011, "median_us": 326.191, "min_us": 317.493, "max_us": 1026.023, "rows": 1, "peak_rss_kb": 3660} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1413415.286, "min_us": 1404827.263, "max_us": 1421410.786, "rows": 1666666, "peak_rss_kb": 5300} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1459722.131, "min_us": 1433407.014, "max_us": 1472920.163, "rows": 1666666, "peak_rss_kb": 5424} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2655, "median_us": 370.185, "min_us": 353.074, "max_us": 1167.725, "rows": 10, "peak_rss_kb": 3800} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2681, "median_us": 362.744, "min_us": 351.987, "max_us": 3781.714, "rows": 10, "peak_rss_kb": 3804} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2804241.349, "min_us": 2798955.462, "max_us": 2832465.12, "rows": 10, "peak_rss_kb": 5020} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2826470.031, "min_us": 2802901.107, "max_us": 2828550.877, "rows": 10, "peak_rss_kb": 5076} +{"round": 2, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2783627.92, "min_us": 2770489.973, "max_us": 2835989.676, "rows": 10, "peak_rss_kb": 5060} +{"round": 2, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2840713.301, "min_us": 2819433.684, "max_us": 2869516.773, "rows": 10, "peak_rss_kb": 4976} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 167, "median_us": 5992.129, "min_us": 5907.214, "max_us": 7420.173, "rows": 10, "peak_rss_kb": 4188} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2139, "median_us": 461.205, "min_us": 445.814, "max_us": 1449.381, "rows": 10, "peak_rss_kb": 3708} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 165, "median_us": 6010.045, "min_us": 5918.006, "max_us": 13073.267, "rows": 10, "peak_rss_kb": 4148} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2141, "median_us": 459.982, "min_us": 442.234, "max_us": 1455.078, "rows": 10, "peak_rss_kb": 3716} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 21.02, "min_us": 20.405, "max_us": 90.846, "rows": 1, "peak_rss_kb": 3768} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 7534, "median_us": 129.666, "min_us": 128.572, "max_us": 424.127, "rows": 1, "peak_rss_kb": 3728} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 19.115, "min_us": 18.488, "max_us": 833.142, "rows": 1, "peak_rss_kb": 3836} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.722, "min_us": 18.353, "max_us": 84.294, "rows": 1, "peak_rss_kb": 3872} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 18.956, "min_us": 18.544, "max_us": 106.506, "rows": 1, "peak_rss_kb": 3788} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.188, "min_us": 18.674, "max_us": 82.323, "rows": 1, "peak_rss_kb": 3804} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3040, "median_us": 323.117, "min_us": 319.783, "max_us": 1014.786, "rows": 1, "peak_rss_kb": 3688} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3024, "median_us": 323.699, "min_us": 316.761, "max_us": 3143.238, "rows": 1, "peak_rss_kb": 3748} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 75, "median_us": 13316.291, "min_us": 13260.185, "max_us": 14963.648, "rows": 16666, "peak_rss_kb": 4856} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 74, "median_us": 13616.487, "min_us": 13580.999, "max_us": 13930.872, "rows": 16666, "peak_rss_kb": 4868} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2669, "median_us": 367.407, "min_us": 349.628, "max_us": 3101.505, "rows": 10, "peak_rss_kb": 3792} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2672, "median_us": 368.129, "min_us": 353.44, "max_us": 1180.806, "rows": 10, "peak_rss_kb": 3728} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25539.126, "min_us": 25343.362, "max_us": 25952.281, "rows": 10, "peak_rss_kb": 4808} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 39, "median_us": 25524.767, "min_us": 25352.26, "max_us": 34469.155, "rows": 10, "peak_rss_kb": 4732} +{"round": 3, "variant": "base", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25410.494, "min_us": 25190.912, "max_us": 25784.034, "rows": 10, "peak_rss_kb": 4820} +{"round": 3, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25475.373, "min_us": 25291.405, "max_us": 25634.825, "rows": 10, "peak_rss_kb": 4788} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 16, "median_us": 62151.739, "min_us": 61771.457, "max_us": 71512.823, "rows": 10, "peak_rss_kb": 4872} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2170, "median_us": 455.727, "min_us": 436.987, "max_us": 1426.886, "rows": 10, "peak_rss_kb": 3776} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 16, "median_us": 62692.349, "min_us": 62058.182, "max_us": 70391.296, "rows": 10, "peak_rss_kb": 4864} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2160, "median_us": 455.012, "min_us": 446.969, "max_us": 1448.312, "rows": 10, "peak_rss_kb": 3700} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.658, "min_us": 20.078, "max_us": 87.886, "rows": 1, "peak_rss_kb": 3800} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 8672, "median_us": 112.401, "min_us": 111.482, "max_us": 378.848, "rows": 1, "peak_rss_kb": 3748} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.758, "min_us": 18.261, "max_us": 762.198, "rows": 1, "peak_rss_kb": 3784} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 19.408, "min_us": 18.908, "max_us": 53.519, "rows": 1, "peak_rss_kb": 3836} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 17.708, "min_us": 16.666, "max_us": 97.138, "rows": 1, "peak_rss_kb": 3740} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 18.045, "min_us": 16.979, "max_us": 78.812, "rows": 1, "peak_rss_kb": 3876} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3060, "median_us": 322.605, "min_us": 318.227, "max_us": 1020.867, "rows": 1, "peak_rss_kb": 3712} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3039, "median_us": 322.721, "min_us": 315.132, "max_us": 3086.509, "rows": 1, "peak_rss_kb": 3628} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 140345.58, "min_us": 139107.113, "max_us": 144205.097, "rows": 166666, "peak_rss_kb": 5240} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 7, "median_us": 142462.574, "min_us": 139147.702, "max_us": 151669.866, "rows": 166666, "peak_rss_kb": 5392} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2590, "median_us": 378.184, "min_us": 371.129, "max_us": 1232.146, "rows": 10, "peak_rss_kb": 3788} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2590, "median_us": 378.752, "min_us": 374.932, "max_us": 1195.303, "rows": 10, "peak_rss_kb": 3776} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 269811.717, "min_us": 268560.762, "max_us": 273601.316, "rows": 10, "peak_rss_kb": 4936} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 269928.907, "min_us": 268640.576, "max_us": 280199.756, "rows": 10, "peak_rss_kb": 5016} +{"round": 3, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 264003.317, "min_us": 263305.06, "max_us": 269180.683, "rows": 10, "peak_rss_kb": 4972} +{"round": 3, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 271249.082, "min_us": 268798.379, "max_us": 272026.983, "rows": 10, "peak_rss_kb": 4988} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 631578.933, "min_us": 630150.198, "max_us": 645590.34, "rows": 10, "peak_rss_kb": 4940} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2123, "median_us": 464.016, "min_us": 456.556, "max_us": 1471.263, "rows": 10, "peak_rss_kb": 3796} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 5, "median_us": 633363.859, "min_us": 630092.466, "max_us": 637886.099, "rows": 10, "peak_rss_kb": 4940} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2197, "median_us": 447.716, "min_us": 428.346, "max_us": 1420.34, "rows": 10, "peak_rss_kb": 3760} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.743, "min_us": 20.16, "max_us": 80.272, "rows": 1, "peak_rss_kb": 3792} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 8209, "median_us": 117.413, "min_us": 112.958, "max_us": 1596.69, "rows": 1, "peak_rss_kb": 3752} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 19.003, "min_us": 18.456, "max_us": 75.737, "rows": 1, "peak_rss_kb": 3776} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.721, "min_us": 18.144, "max_us": 99.593, "rows": 1, "peak_rss_kb": 3736} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 18.021, "min_us": 17.197, "max_us": 79.7, "rows": 1, "peak_rss_kb": 3824} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 17.958, "min_us": 17.261, "max_us": 77.188, "rows": 1, "peak_rss_kb": 3824} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3023, "median_us": 321.929, "min_us": 316.297, "max_us": 4268.482, "rows": 1, "peak_rss_kb": 3708} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3056, "median_us": 321.053, "min_us": 316.292, "max_us": 1029.261, "rows": 1, "peak_rss_kb": 3672} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1458306.83, "min_us": 1415763.675, "max_us": 1544801.943, "rows": 1666666, "peak_rss_kb": 5324} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1468171.017, "min_us": 1455057.28, "max_us": 1484504.613, "rows": 1666666, "peak_rss_kb": 5380} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2674, "median_us": 367.552, "min_us": 348.627, "max_us": 1150.778, "rows": 10, "peak_rss_kb": 3800} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2711, "median_us": 362.713, "min_us": 350.321, "max_us": 1154.281, "rows": 10, "peak_rss_kb": 3856} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2782133.505, "min_us": 2777786.476, "max_us": 2826370.259, "rows": 10, "peak_rss_kb": 4988} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2829604.637, "min_us": 2824145.703, "max_us": 2877554.562, "rows": 10, "peak_rss_kb": 5180} +{"round": 3, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2790627.058, "min_us": 2777566.206, "max_us": 2859175.51, "rows": 10, "peak_rss_kb": 5080} +{"round": 3, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2849620.061, "min_us": 2834464.183, "max_us": 2872590.182, "rows": 10, "peak_rss_kb": 5104} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2125, "median_us": 457.675, "min_us": 442.189, "max_us": 3893.195, "rows": 10, "peak_rss_kb": 3760} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 166, "median_us": 6046.133, "min_us": 6017.683, "max_us": 6127.19, "rows": 10, "peak_rss_kb": 4196} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2147, "median_us": 456.76, "min_us": 442.329, "max_us": 1447.457, "rows": 10, "peak_rss_kb": 3740} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 152, "median_us": 6205.975, "min_us": 6141.856, "max_us": 55593.991, "rows": 10, "peak_rss_kb": 4196} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 7513, "median_us": 130.114, "min_us": 129.01, "max_us": 420.986, "rows": 1, "peak_rss_kb": 3736} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.883, "min_us": 20.327, "max_us": 92.962, "rows": 1, "peak_rss_kb": 3812} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.687, "min_us": 18.132, "max_us": 68.964, "rows": 1, "peak_rss_kb": 3772} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.691, "min_us": 18.157, "max_us": 104.451, "rows": 1, "peak_rss_kb": 3836} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.187, "min_us": 18.541, "max_us": 91.35, "rows": 1, "peak_rss_kb": 3780} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 20.339, "min_us": 19.823, "max_us": 882.814, "rows": 1, "peak_rss_kb": 3792} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3039, "median_us": 325.605, "min_us": 321.91, "max_us": 515.58, "rows": 1, "peak_rss_kb": 3752} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3039, "median_us": 324.659, "min_us": 320.732, "max_us": 1024.67, "rows": 1, "peak_rss_kb": 3668} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 73, "median_us": 13510.332, "min_us": 13451.291, "max_us": 21438.851, "rows": 16666, "peak_rss_kb": 4912} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 75, "median_us": 13320.631, "min_us": 13278.934, "max_us": 14391.089, "rows": 16666, "peak_rss_kb": 4924} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2691, "median_us": 364.746, "min_us": 354.872, "max_us": 1179.088, "rows": 10, "peak_rss_kb": 3760} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2729, "median_us": 355.784, "min_us": 343.443, "max_us": 3072.965, "rows": 10, "peak_rss_kb": 3848} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25466.605, "min_us": 25284.151, "max_us": 25693.397, "rows": 10, "peak_rss_kb": 4784} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25410.917, "min_us": 25248.053, "max_us": 26951.89, "rows": 10, "peak_rss_kb": 4824} +{"round": 4, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 39, "median_us": 25525.559, "min_us": 25363.884, "max_us": 33677.51, "rows": 10, "peak_rss_kb": 4736} +{"round": 4, "variant": "base", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25357.592, "min_us": 25255.153, "max_us": 25674.034, "rows": 10, "peak_rss_kb": 4744} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2157, "median_us": 454.513, "min_us": 445.028, "max_us": 1446.067, "rows": 10, "peak_rss_kb": 3736} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 17, "median_us": 62224.422, "min_us": 62118.336, "max_us": 62671.293, "rows": 10, "peak_rss_kb": 4864} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2122, "median_us": 458.485, "min_us": 451.069, "max_us": 1468.055, "rows": 10, "peak_rss_kb": 3760} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 16, "median_us": 62786.439, "min_us": 62341.531, "max_us": 69924.452, "rows": 10, "peak_rss_kb": 4876} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 8696, "median_us": 111.982, "min_us": 110.869, "max_us": 374.828, "rows": 1, "peak_rss_kb": 3652} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.992, "min_us": 20.45, "max_us": 120.98, "rows": 1, "peak_rss_kb": 3764} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.897, "min_us": 18.306, "max_us": 96.854, "rows": 1, "peak_rss_kb": 3724} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.704, "min_us": 18.135, "max_us": 82.092, "rows": 1, "peak_rss_kb": 3792} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 17.957, "min_us": 16.878, "max_us": 730.23, "rows": 1, "peak_rss_kb": 3724} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 17.761, "min_us": 16.78, "max_us": 89.316, "rows": 1, "peak_rss_kb": 3772} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3026, "median_us": 324.006, "min_us": 319.588, "max_us": 1016.641, "rows": 1, "peak_rss_kb": 3596} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3097, "median_us": 317.182, "min_us": 313.156, "max_us": 1014.38, "rows": 1, "peak_rss_kb": 3716} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 140614.463, "min_us": 139890.671, "max_us": 151900.196, "rows": 166666, "peak_rss_kb": 5232} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 141954.845, "min_us": 140265.582, "max_us": 142687.104, "rows": 166666, "peak_rss_kb": 5308} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2560, "median_us": 359.217, "min_us": 345.007, "max_us": 43007.652, "rows": 10, "peak_rss_kb": 3768} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2667, "median_us": 365.688, "min_us": 346.404, "max_us": 1208.721, "rows": 10, "peak_rss_kb": 3728} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 269981.315, "min_us": 267355.21, "max_us": 279352.781, "rows": 10, "peak_rss_kb": 4968} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 266472.531, "min_us": 265781.403, "max_us": 272149.809, "rows": 10, "peak_rss_kb": 5044} +{"round": 4, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 269351.827, "min_us": 267736.932, "max_us": 272557.143, "rows": 10, "peak_rss_kb": 4976} +{"round": 4, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 266627.634, "min_us": 265361.055, "max_us": 273226.176, "rows": 10, "peak_rss_kb": 5056} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2131, "median_us": 462.172, "min_us": 454.803, "max_us": 1460.247, "rows": 10, "peak_rss_kb": 3724} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 655217.898, "min_us": 652033.238, "max_us": 664513.1, "rows": 10, "peak_rss_kb": 4844} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2170, "median_us": 454.699, "min_us": 447.214, "max_us": 1491.166, "rows": 10, "peak_rss_kb": 3712} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 5, "median_us": 655544.346, "min_us": 654890.675, "max_us": 663812.733, "rows": 10, "peak_rss_kb": 4884} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 8335, "median_us": 117.358, "min_us": 113.467, "max_us": 443.108, "rows": 1, "peak_rss_kb": 3728} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.978, "min_us": 20.313, "max_us": 803.005, "rows": 1, "peak_rss_kb": 3808} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.79, "min_us": 18.307, "max_us": 100.77, "rows": 1, "peak_rss_kb": 3888} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 19.23, "min_us": 18.639, "max_us": 104.854, "rows": 1, "peak_rss_kb": 3740} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 18.544, "min_us": 17.562, "max_us": 103.305, "rows": 1, "peak_rss_kb": 3832} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 18.027, "min_us": 17.228, "max_us": 80.408, "rows": 1, "peak_rss_kb": 3796} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3027, "median_us": 324.824, "min_us": 316.632, "max_us": 1024.851, "rows": 1, "peak_rss_kb": 3760} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 2904, "median_us": 320.52, "min_us": 315.554, "max_us": 46020.541, "rows": 1, "peak_rss_kb": 3648} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1433884.677, "min_us": 1417249.656, "max_us": 1439564.502, "rows": 1666666, "peak_rss_kb": 5312} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1444895.082, "min_us": 1435585.716, "max_us": 1463531.389, "rows": 1666666, "peak_rss_kb": 5332} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2635, "median_us": 368.19, "min_us": 351.516, "max_us": 3801.569, "rows": 10, "peak_rss_kb": 3720} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2658, "median_us": 369.493, "min_us": 356.178, "max_us": 1164.922, "rows": 10, "peak_rss_kb": 3804} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2790671.454, "min_us": 2773009.669, "max_us": 2805710.933, "rows": 10, "peak_rss_kb": 5100} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2817039.274, "min_us": 2809935.538, "max_us": 2858113.487, "rows": 10, "peak_rss_kb": 5132} +{"round": 4, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2770028.937, "min_us": 2760826.163, "max_us": 2816613.33, "rows": 10, "peak_rss_kb": 4996} +{"round": 4, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2831752.835, "min_us": 2814714.104, "max_us": 2843993.936, "rows": 10, "peak_rss_kb": 5080} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 167, "median_us": 5940.144, "min_us": 5902.1, "max_us": 7533.984, "rows": 10, "peak_rss_kb": 4144} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2136, "median_us": 457.412, "min_us": 444.509, "max_us": 3904.184, "rows": 10, "peak_rss_kb": 3724} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 147, "median_us": 6719.9, "min_us": 6680.681, "max_us": 7426.924, "rows": 10, "peak_rss_kb": 4160} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2150, "median_us": 457.548, "min_us": 438.404, "max_us": 1450.648, "rows": 10, "peak_rss_kb": 3768} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 22.528, "min_us": 21.86, "max_us": 95.825, "rows": 1, "peak_rss_kb": 3836} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 7502, "median_us": 129.105, "min_us": 128.007, "max_us": 1654.713, "rows": 1, "peak_rss_kb": 3704} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.85, "min_us": 18.416, "max_us": 98.233, "rows": 1, "peak_rss_kb": 3788} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.836, "min_us": 18.362, "max_us": 114.89, "rows": 1, "peak_rss_kb": 3800} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.065, "min_us": 18.578, "max_us": 113.401, "rows": 1, "peak_rss_kb": 3824} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.233, "min_us": 18.764, "max_us": 97.688, "rows": 1, "peak_rss_kb": 3832} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3020, "median_us": 321.996, "min_us": 315.363, "max_us": 3757.335, "rows": 1, "peak_rss_kb": 3660} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3053, "median_us": 320.297, "min_us": 317.55, "max_us": 1038.069, "rows": 1, "peak_rss_kb": 3708} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 75, "median_us": 13309.306, "min_us": 13270.652, "max_us": 15037.819, "rows": 16666, "peak_rss_kb": 4916} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 74, "median_us": 13447.968, "min_us": 13244.994, "max_us": 21792.858, "rows": 16666, "peak_rss_kb": 4964} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2804, "median_us": 349.757, "min_us": 338.03, "max_us": 1167.227, "rows": 10, "peak_rss_kb": 3768} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2739, "median_us": 358.712, "min_us": 347.008, "max_us": 1166.135, "rows": 10, "peak_rss_kb": 3788} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 38, "median_us": 25420.645, "min_us": 25281.817, "max_us": 78729.953, "rows": 10, "peak_rss_kb": 4816} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25521.427, "min_us": 25332.376, "max_us": 27144.593, "rows": 10, "peak_rss_kb": 4788} +{"round": 5, "variant": "base", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25314.077, "min_us": 25222.843, "max_us": 25938.461, "rows": 10, "peak_rss_kb": 4792} +{"round": 5, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 39, "median_us": 25791.413, "min_us": 25605.929, "max_us": 34646.837, "rows": 10, "peak_rss_kb": 4832} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 16, "median_us": 62340.02, "min_us": 62076.545, "max_us": 65314.216, "rows": 10, "peak_rss_kb": 4840} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2162, "median_us": 453.213, "min_us": 433.548, "max_us": 4369.987, "rows": 10, "peak_rss_kb": 3724} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 16, "median_us": 62611.942, "min_us": 62326.632, "max_us": 65096.269, "rows": 10, "peak_rss_kb": 4844} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2137, "median_us": 460.96, "min_us": 454.143, "max_us": 1446.706, "rows": 10, "peak_rss_kb": 3792} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.656, "min_us": 20.166, "max_us": 106.557, "rows": 1, "peak_rss_kb": 3828} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 8606, "median_us": 112.244, "min_us": 111.368, "max_us": 1630.003, "rows": 1, "peak_rss_kb": 3704} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 19.039, "min_us": 18.477, "max_us": 81.735, "rows": 1, "peak_rss_kb": 3788} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.484, "min_us": 18.051, "max_us": 83.495, "rows": 1, "peak_rss_kb": 3800} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 17.919, "min_us": 16.964, "max_us": 82.981, "rows": 1, "peak_rss_kb": 3780} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 17.816, "min_us": 16.751, "max_us": 80.222, "rows": 1, "peak_rss_kb": 3828} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3045, "median_us": 320.416, "min_us": 312.736, "max_us": 3632.054, "rows": 1, "peak_rss_kb": 3692} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 2993, "median_us": 328.48, "min_us": 316.418, "max_us": 1043.398, "rows": 1, "peak_rss_kb": 3600} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 141426.393, "min_us": 139669.851, "max_us": 142368.962, "rows": 166666, "peak_rss_kb": 5272} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 8, "median_us": 141614.204, "min_us": 140116.418, "max_us": 141980.243, "rows": 166666, "peak_rss_kb": 5236} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2536, "median_us": 386.696, "min_us": 381.829, "max_us": 1227.672, "rows": 10, "peak_rss_kb": 3776} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2589, "median_us": 375.033, "min_us": 367.862, "max_us": 3901.606, "rows": 10, "peak_rss_kb": 3748} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 270131.036, "min_us": 266085.499, "max_us": 276004.337, "rows": 10, "peak_rss_kb": 5020} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 269936.996, "min_us": 266148.559, "max_us": 274451.616, "rows": 10, "peak_rss_kb": 4972} +{"round": 5, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 265589.121, "min_us": 263711.785, "max_us": 271796.047, "rows": 10, "peak_rss_kb": 5104} +{"round": 5, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 269582.785, "min_us": 268294.791, "max_us": 319527.977, "rows": 10, "peak_rss_kb": 4964} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 634253.357, "min_us": 629656.282, "max_us": 640058.486, "rows": 10, "peak_rss_kb": 4916} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2123, "median_us": 459.371, "min_us": 448.981, "max_us": 5757.382, "rows": 10, "peak_rss_kb": 3708} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 5, "median_us": 632806.611, "min_us": 631847.557, "max_us": 639441.286, "rows": 10, "peak_rss_kb": 4908} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2182, "median_us": 449.749, "min_us": 423.926, "max_us": 4586.758, "rows": 10, "peak_rss_kb": 3788} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.994, "min_us": 20.351, "max_us": 89.951, "rows": 1, "peak_rss_kb": 3828} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 8352, "median_us": 116.621, "min_us": 113.364, "max_us": 375.69, "rows": 1, "peak_rss_kb": 3820} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.724, "min_us": 18.18, "max_us": 115.29, "rows": 1, "peak_rss_kb": 3780} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.787, "min_us": 18.278, "max_us": 90.777, "rows": 1, "peak_rss_kb": 3796} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 17.99, "min_us": 17.298, "max_us": 821.725, "rows": 1, "peak_rss_kb": 3784} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 17.468, "min_us": 16.861, "max_us": 83.218, "rows": 1, "peak_rss_kb": 3784} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3042, "median_us": 322.319, "min_us": 316.741, "max_us": 1031.162, "rows": 1, "peak_rss_kb": 3696} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3053, "median_us": 321.851, "min_us": 316.93, "max_us": 1030.831, "rows": 1, "peak_rss_kb": 3708} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1415529.756, "min_us": 1396228.037, "max_us": 1438827.33, "rows": 1666666, "peak_rss_kb": 5280} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1466317.473, "min_us": 1452121.592, "max_us": 1477550.298, "rows": 1666666, "peak_rss_kb": 5348} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2672, "median_us": 367.935, "min_us": 355.391, "max_us": 1151.57, "rows": 10, "peak_rss_kb": 3768} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2619, "median_us": 375.695, "min_us": 355.409, "max_us": 3787.142, "rows": 10, "peak_rss_kb": 3808} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2825886.763, "min_us": 2789056.321, "max_us": 2831072.01, "rows": 10, "peak_rss_kb": 4996} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2894368.385, "min_us": 2873784.098, "max_us": 2947529.973, "rows": 10, "peak_rss_kb": 4984} +{"round": 5, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2806003.586, "min_us": 2805078.305, "max_us": 2866379.403, "rows": 10, "peak_rss_kb": 5020} +{"round": 5, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2833082.311, "min_us": 2805646.459, "max_us": 2864104.49, "rows": 10, "peak_rss_kb": 4972} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2152, "median_us": 449.747, "min_us": 439.822, "max_us": 1452.048, "rows": 10, "peak_rss_kb": 3688} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 168, "median_us": 5954.685, "min_us": 5900.64, "max_us": 6329.47, "rows": 10, "peak_rss_kb": 4104} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2036, "median_us": 457.269, "min_us": 443.036, "max_us": 46135.642, "rows": 10, "peak_rss_kb": 3684} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 165, "median_us": 6023.443, "min_us": 5985.14, "max_us": 6751.657, "rows": 10, "peak_rss_kb": 4148} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 7495, "median_us": 130.358, "min_us": 129.207, "max_us": 424.705, "rows": 1, "peak_rss_kb": 3720} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "ordered_point", "query": "[:find ?a :where [:p8333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 21.239, "min_us": 20.483, "max_us": 801.792, "rows": 1, "peak_rss_kb": 3804} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.945, "min_us": 18.425, "max_us": 78.484, "rows": 1, "peak_rss_kb": 3824} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "point_entity", "query": "[:find ?a :where [:p8333 :age ?a]]", "runs": 20000, "median_us": 18.846, "min_us": 18.085, "max_us": 81.785, "rows": 1, "peak_rss_kb": 3816} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 18.749, "min_us": 18.385, "max_us": 80.371, "rows": 1, "peak_rss_kb": 3792} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p8333\"]]", "runs": 20000, "median_us": 19.272, "min_us": 18.729, "max_us": 88.204, "rows": 1, "peak_rss_kb": 3784} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3015, "median_us": 325.137, "min_us": 321.612, "max_us": 1023.708, "rows": 1, "peak_rss_kb": 3704} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3042, "median_us": 318.987, "min_us": 315.13, "max_us": 3190.883, "rows": 1, "peak_rss_kb": 3704} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 74, "median_us": 13644.784, "min_us": 13441.086, "max_us": 14953.032, "rows": 16666, "peak_rss_kb": 5016} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 75, "median_us": 13332.163, "min_us": 13295.852, "max_us": 13637.668, "rows": 16666, "peak_rss_kb": 4904} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2699, "median_us": 362.467, "min_us": 348.94, "max_us": 4637.761, "rows": 10, "peak_rss_kb": 3792} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2785, "median_us": 349.651, "min_us": 337.946, "max_us": 1194.415, "rows": 10, "peak_rss_kb": 3824} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25477.454, "min_us": 25296.035, "max_us": 32545.04, "rows": 10, "peak_rss_kb": 4888} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 40, "median_us": 25408.296, "min_us": 25257.617, "max_us": 27488.853, "rows": 10, "peak_rss_kb": 4836} +{"round": 6, "variant": "pr", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 40, "median_us": 25452.11, "min_us": 25229.554, "max_us": 25938.933, "rows": 10, "peak_rss_kb": 4840} +{"round": 6, "variant": "base", "scale": "100k", "facts": 100000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 39, "median_us": 25427.593, "min_us": 25285.603, "max_us": 34807.336, "rows": 10, "peak_rss_kb": 4784} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2182, "median_us": 454.092, "min_us": 432.554, "max_us": 1426.114, "rows": 10, "peak_rss_kb": 3728} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 17, "median_us": 62238.019, "min_us": 62014.423, "max_us": 62734.557, "rows": 10, "peak_rss_kb": 4888} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2156, "median_us": 453.242, "min_us": 445.124, "max_us": 4557.277, "rows": 10, "peak_rss_kb": 3740} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 16, "median_us": 62591.193, "min_us": 62067.688, "max_us": 63364.919, "rows": 10, "peak_rss_kb": 4896} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 8664, "median_us": 113.074, "min_us": 112.091, "max_us": 396.071, "rows": 1, "peak_rss_kb": 3748} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "ordered_point", "query": "[:find ?a :where [:p83333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 20.789, "min_us": 20.166, "max_us": 826.547, "rows": 1, "peak_rss_kb": 3820} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.794, "min_us": 18.089, "max_us": 81.508, "rows": 1, "peak_rss_kb": 3800} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "point_entity", "query": "[:find ?a :where [:p83333 :age ?a]]", "runs": 20000, "median_us": 18.693, "min_us": 18.096, "max_us": 81.38, "rows": 1, "peak_rss_kb": 3764} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 18.179, "min_us": 17.129, "max_us": 88.605, "rows": 1, "peak_rss_kb": 3840} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p83333\"]]", "runs": 20000, "median_us": 17.806, "min_us": 16.912, "max_us": 82.694, "rows": 1, "peak_rss_kb": 3736} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3042, "median_us": 319.166, "min_us": 313.584, "max_us": 1017.056, "rows": 1, "peak_rss_kb": 3708} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3052, "median_us": 317.914, "min_us": 313.145, "max_us": 3779.308, "rows": 1, "peak_rss_kb": 3700} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 7, "median_us": 143500.959, "min_us": 142932.708, "max_us": 144050.45, "rows": 166666, "peak_rss_kb": 5196} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 7, "median_us": 140802.695, "min_us": 140308.563, "max_us": 196677.75, "rows": 166666, "peak_rss_kb": 5340} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2654, "median_us": 367.841, "min_us": 347.205, "max_us": 1200.188, "rows": 10, "peak_rss_kb": 3780} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2603, "median_us": 377.727, "min_us": 371.678, "max_us": 1198.651, "rows": 10, "peak_rss_kb": 3744} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 269201.464, "min_us": 264429.313, "max_us": 269947.052, "rows": 10, "peak_rss_kb": 5092} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 269910.76, "min_us": 266262.095, "max_us": 280000.156, "rows": 10, "peak_rss_kb": 4996} +{"round": 6, "variant": "pr", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 270771.373, "min_us": 267257.138, "max_us": 277226.004, "rows": 10, "peak_rss_kb": 5008} +{"round": 6, "variant": "base", "scale": "1m", "facts": 1000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 266122.96, "min_us": 265990.576, "max_us": 267802.657, "rows": 10, "peak_rss_kb": 5000} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 2046, "median_us": 476.242, "min_us": 464.735, "max_us": 4238.672, "rows": 10, "peak_rss_kb": 3680} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_limit", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 656110.882, "min_us": 652421.477, "max_us": 668495.79, "rows": 10, "peak_rss_kb": 4868} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 2115, "median_us": 459.391, "min_us": 451.266, "max_us": 4649.977, "rows": 10, "peak_rss_kb": 3652} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_offset", "query": "[:find ?a :where [?e :age ?a] :order-by [?a] :offset 13 :limit 10]", "runs": 5, "median_us": 654683.528, "min_us": 650668.694, "max_us": 665503.244, "rows": 10, "peak_rss_kb": 4920} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 8279, "median_us": 117.728, "min_us": 114.385, "max_us": 3702.814, "rows": 1, "peak_rss_kb": 3732} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "ordered_point", "query": "[:find ?a :where [:p833333 :age ?a] :order-by [?a] :limit 1]", "runs": 20000, "median_us": 21.393, "min_us": 20.72, "max_us": 97.104, "rows": 1, "peak_rss_kb": 3776} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 19.087, "min_us": 18.554, "max_us": 51.002, "rows": 1, "peak_rss_kb": 3820} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "point_entity", "query": "[:find ?a :where [:p833333 :age ?a]]", "runs": 20000, "median_us": 18.709, "min_us": 18.151, "max_us": 82.658, "rows": 1, "peak_rss_kb": 3820} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 18.112, "min_us": 17.312, "max_us": 78.814, "rows": 1, "peak_rss_kb": 3836} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_value", "query": "[:find ?e :where [?e :name \"p833333\"]]", "runs": 20000, "median_us": 17.649, "min_us": 16.836, "max_us": 20292.809, "rows": 1, "peak_rss_kb": 3780} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 2726, "median_us": 360.232, "min_us": 354.597, "max_us": 1149.5, "rows": 1, "peak_rss_kb": 3684} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "hot_current", "query": "[:find ?v :where [:hot :counter ?v]]", "runs": 3021, "median_us": 325.581, "min_us": 321.048, "max_us": 1021.079, "rows": 1, "peak_rss_kb": 3664} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1402743.92, "min_us": 1393367.024, "max_us": 1414092.757, "rows": 1666666, "peak_rss_kb": 5384} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "attribute_scan", "query": "[:find ?e ?a :where [?e :age ?a]]", "runs": 5, "median_us": 1463174.214, "min_us": 1452727.936, "max_us": 1469611.304, "rows": 1666666, "peak_rss_kb": 5336} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2621, "median_us": 379.463, "min_us": 356.207, "max_us": 1159.957, "rows": 10, "peak_rss_kb": 3800} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "limit", "query": "[:find ?e ?a :where [?e :age ?a] :limit 10]", "runs": 2700, "median_us": 363.288, "min_us": 349.863, "max_us": 1153.558, "rows": 10, "peak_rss_kb": 3784} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2835412.893, "min_us": 2779304.23, "max_us": 2852042.708, "rows": 10, "peak_rss_kb": 5032} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "uuid_ties", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a] :limit 10]", "runs": 5, "median_us": 2827626.795, "min_us": 2793018.172, "max_us": 2856214.553, "rows": 10, "peak_rss_kb": 5048} +{"round": 6, "variant": "pr", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2778247.097, "min_us": 2760697.497, "max_us": 2819228.37, "rows": 10, "peak_rss_kb": 5028} +{"round": 6, "variant": "base", "scale": "10m", "facts": 10000000, "workload": "top_k", "query": "[:find ?e ?a :where [?e :age ?a] :order-by [?a :desc] :limit 10]", "runs": 5, "median_us": 2820626.457, "min_us": 2805712.451, "max_us": 2874229.979, "rows": 10, "peak_rss_kb": 4984} diff --git a/docs/superpowers/plans/2026-10-28-641-input-order.md b/docs/superpowers/plans/2026-10-28-641-input-order.md new file mode 100644 index 0000000000..268d494947 --- /dev/null +++ b/docs/superpowers/plans/2026-10-28-641-input-order.md @@ -0,0 +1,137 @@ +# #641 implementation plan + +Base: origin/v3 `2abf53df05447755490d017bc2daf89f4d59cdf5`. +Status: Claude-reviewed; final conditional-approval corrections applied. +Maintainer approved implementation on 2026-10-28. +Spec: `docs/superpowers/specs/2026-10-28-641-input-order-design.md`. + +1. Obtain Claude's independent spec and implementation-plan review. Verify its + findings in the code, revise and re-review any changed contracts. Present the + reviewed design and bounded scope for maintainer approval before implementation. +2. Use the worktree skill after approval: verify `.worktrees/` is ignored, create + `.worktrees/641-input-order` on `feat/641-input-order` from refreshed origin/v3. + Check for nested instructions and revalidate the design against base changes. + Copy approved spec/plan into docs/superpowers. Main remains untouched. +3. Check bench reachability, idleness and available disk; create a task-specific + scratch checkout/copy and record the exact source revision. Reuse existing + target caches deliberately; create no tests/builds on the laptop. Run the + repository-required baseline checks there before production code changes. +4. TDD order properties first. Add the private unit-test and test-hooks + forced-optimization/fallback switch (like `__reorder`) before relying on it + as a differential oracle. Add tests for comparator-specific prefix matching, + constants/repeated slots, replacements, all Step kinds, hash/probe fallbacks, + projected Distinct canonicalization and group-equality adjacency. Confirm + red on the bench, implement the smallest private metadata module, then green. + Callback detection must walk nested expressions, bindings, not/or bodies, + aggregate descriptors and WindowFunc::Udf; existing plan::udfs alone misses + nested calls. Test those exclusions before enabling any strategy. +5. TDD snapshot/scan resolution. Implement a top-level resolver between + engine::open/resolve(TxBound) and stream/build, receiving the actual snapshot, + keys and function-registry snapshot. The logical Plan carries candidates; + after all proofs succeed the pass chooses source index and holder strategies, + removes Sort with `plan.find = Sort.cols`, and computes hold_ids from the + resolved Window mode. Failed optional reads leave all original fields/choices + intact. Do not push demand into not/or/correlated body plans, and leave + open_rules unchanged. Test pending+staged guards, pinned snapshot + stability, whole-range kind disqualification and bounded read counts with + an instrumented key source. Use existing pending_len (already includes staged) + as a zero-cost fast check; otherwise add a short-circuit range-existence probe + over the captured pending/staged index view, with no full clone or net-assert. + Test unrelated vs in-range pending records, retractions and post-snapshot + writes. Verify large_reader/with_committed sees complete AVET working roots + after finished statements and after rejected-statement rollback. Add a direct + regression: published data holds only integers for an attribute; a completed + large-transaction statement adds a float; a later query in that transaction + must use the working reader for proof and keep Sort. After rollback/new + queries, do not reuse the old proof. Include many + tombstoned historical keys: raw + prefix existence must not scan them to decide there is no live value. Add + the private KeySource raw-prefix predicate via one LeafCursor seek. Test + proof-read failure returning ordinary + fallback, not a new error. Implement demand-specific AVET alternatives and + safe proof reads. Keep existing entity/exact ranges and zero demand unchanged. + Initial properties require the outermost source's unbound value position, + distinct source variables and a single physical range. Test keyword/ref + literal alternates and float-zero/set literal encodings remain uncertified. + Reuse existing selective EAVT e/a value order when proved, rather than + broadening it to AVET. + Resolve choices once per Stream open; nested bodies keep their original + construction and receive no optimization demand. +6. TDD Sort omission end to end: compare forced fallback vs optimized lists on + the same snapshot, assert no Sort and early scan stop for the positive scalar + case, Sort retention for full tie suffixes/type/direction failures. Preserve + projection slot mapping and Limit offset semantics, including a nonidentity + Sort.cols regression. Add callback-count and later CollectSet-error tests + proving those pipelines retain Sort. Add prepared/cursor/ + rule/pending/temporal and invalidation regressions. Run focused suites and + required portability checks on the bench; measure startup proof overhead and + the ordered limit workload against immutable base. Synchronize PR 1 docs, + get Claude code review and verify findings before preparing PR 1 against v3. +7. TDD streaming Aggregate as PR 2. Verify the implementation descriptors of + count/count-distinct cannot raise aggregate data errors. Restrict to one + group column in semantic Value::Ord order, no :with/window/callback/CollectSet. + Extract/reuse a one-group finish helper after representative/empty tests fail. + Test cross-batch groups, signed zeros, mixed numeric grouping and early Limit. + Fallible aggregates/:with/multiple grouping keys remain materialized; add + later-group data-error, dropped-group precedence, UDF callback and CollectSet + failure regressions to verify those fallbacks. Implement one active group plus + bounded input/output batches, no finished-results list. Assert active-group + high-water=1, memory independent of completed groups and early input stopping. + Evict transient DICT caches between safe internal child-batch pulls, not only + when returning to Stream. Test unique scalar group-key Sort omission with a + single kind and retention for mixed numeric kinds; benchmark count/count-distinct at + scaling sizes. Run aggregate/memory/cursor checks, update docs and obtain + Claude's code review before preparing PR 2. +8. TDD partition Window as PR 3. Add compatible/incompatible multiple-window + queries, callback/CollectSet/aggregate-query fallbacks, physical input order and boundary-crossing cases + for peers/rank/row-number/lag/lead/all row frames. Implement one partition with + lookahead and reuse shared windows evaluator. Select DICT cache lifetime from + actual Window strategy; evict transient caches at internal child-batch + boundaries. Verify Window and IdSpace peak stay bounded for fixed + committed partitions while total size increases, including close/rewind/error + and checkpoint pinning. Run window/memory/cursor/prepared/limit suites and + benchmark one growing partition plus many fixed-size partitions. +9. Finish each slice with fresh required verification on the bench: full cargo + tests including test-hooks, documented all-feature clippy and WASM/WASI checks, + applicable coverage floors and binary-size gate; fmt may run locally. Run + meaningful A/B envelope/point guards once per final relevant revision. Record + optimized committed-memory-backend fixtures on WASI/browser where supported, + and record unavailable runner limitations precisely. Follow the numeric + acceptance gates in spec §8.1; frozen bag digests remain unchanged and are + never re-blessed. If keys.rs changes, run existing Kani encoder harnesses on + the bench; add no decoder/string harnesses. Do not rerun broad checks without + a code change/failure/unresolved risk. Clean task-created remote scratch; + document retained reusable state and remove it when the task ends. +10. Cross-check all repository status/test-count/reference/perf docs and the + docs-site version-scoped architecture update. Record benchmark IDs and actual + nightly filter routing for #776. Obtain Claude's final code/evidence review + before opening each PR. Re-review material fixes, open PRs against v3, and + monitor CI/fix failures. Do not merge or close the issue without the + maintainer's authorization and complete acceptance evidence. + +Update stale module/field comments in engine/sort.rs, aggregate.rs, window.rs, +ids.rs and mod.rs; CLAUDE.md's operator descriptions; ROADMAP.md's prior v3.next +entry (current issue milestone is v3.0.0); docs/BENCHMARKS.md; and the coverage +inventory. Strategy counter names are private (the profiler is not yet public): +an omitted Sort has no counter, and chosen Aggregate/Window modes have explicit +private markers for tests and the future #185 profiler. + +Representative required commands, all heavy commands on the bench: + +```sh +cargo test --quiet +cargo test --features test-hooks +cargo clippy --all-features -- -D warnings +cargo clippy --target wasm32-unknown-unknown --features browser -- -D warnings +cargo clippy --target wasm32-wasip1 -- -D warnings +cargo test --target wasm32-wasip1 --lib --tests +cargo build --release +cargo kani --lib -j --output-format terse -Z unstable-options --harness-timeout 10m +``` + +Use the pinned coverage workflow toolchain and scripts for the coverage gate; +validate the release binary against 1,259,520 bytes. Run wasm-pack browser tests +with the project's CI recipe if runners are installed. Fmt may run locally. + +No version bump, release tag, public config/type hints, new dependency, index +format change, disk spill, source-run merge or generalized optimizer is planned. diff --git a/docs/superpowers/specs/2026-10-24-limit-order-by-design.md b/docs/superpowers/specs/2026-10-24-limit-order-by-design.md index ae87308e05..008fbd70d7 100644 --- a/docs/superpowers/specs/2026-10-24-limit-order-by-design.md +++ b/docs/superpowers/specs/2026-10-24-limit-order-by-design.md @@ -3,6 +3,7 @@ **Milestone:** v3.0.0, branch `v3`. No change to the `.graph` format, the WAL format or the public Rust API. **Follows:** #473 (streaming engine; its `Limit`/`Offset` operators, §6.1 there, and `Sort`, §6.2 there, are built here), #547 (`value_order`). **Leaves to #641 (v3.next):** skipping `Sort` when an index already returns the rows in order, and sort-grouped `Aggregate`. +**Follow-up, 2026-10-28:** #641 now targets v3.0.0; its approved three-slice scope is recorded in [the input-order design](2026-10-28-641-input-order-design.md). This document retains the original #306 decisions below. **Status:** approved 2026-10-24; not implemented. ## 1. Decisions diff --git a/docs/superpowers/specs/2026-10-28-641-input-order-design.md b/docs/superpowers/specs/2026-10-28-641-input-order-design.md new file mode 100644 index 0000000000..4e93d0f37e --- /dev/null +++ b/docs/superpowers/specs/2026-10-28-641-input-order-design.md @@ -0,0 +1,389 @@ +# #641: use proven input order in the streaming engine + +Date: 2026-10-28. Base: `origin/v3` at `2abf53df05447755490d017bc2daf89f4d59cdf5`. +Status: Claude-reviewed; final conditional-approval corrections applied. +Maintainer approved implementation on 2026-10-28. Delivery is split into three slices (§9). +Issue: https://github.com/project-minigraf/minigraf/issues/641 +Target: `v3`, following the issue's current v3.0.0 milestone. The older #306 +spec called this v3.next; the current issue milestone takes precedence. + +## Purpose and philosophy + +Avoid a Sort when a scan/operator already produces the required full order; +reduce eligible grouped Aggregate state to one contiguous group; and buffer +only one Window partition when its input makes that possible. Preserve query +answers, grouping/peer rules, deterministic built-in aggregate errors, snapshot +isolation, and memory accounting. Existing top-k Sort already implements the +bounded `offset + limit` fallback and is retained. + +This follows PHILOSOPHY.md §§4–8: reuse existing indexes and operators, add no +dependencies or configuration, and change no public API, syntax, database or WAL +format. Reliability takes priority over covering every possible index order. +Only proved cases use streaming strategies; other queries retain the existing +operators. This does not promise bounded memory for all grouped queries. + +## Existing contracts that constrain the change + +- A Scan emits committed ranges, pending facts, and derived rows in succession. + Those runs are not one sorted stream. Pending keys use UUID/text order; + committed entity/ident positions use DICT ids. +- `:order-by` sorts by explicit keys and every remaining `:find` column ascending. + Matching only the explicit keys is insufficient for pagination. +- Index tag order, `Value::Ord` (group/partition equality and aggregate output), + and `value_order` (Sort/window ranking/peers) are different comparators. +- Committed float keys canonicalize NaNs and distinguish signed zeros. Group + equality equates all NaNs and equates the zeros. Composite grouping can split + an equal group across different zero encodings. +- Long strings use prefix/hash/reference keys. Sets can have different encoded + keys despite equal elements. Neither is presumed lexically ordered. +- Aggregate drains its input, finishes groups in `Value::Ord` grouping-key order, + and returns no row until every group is validated. A first aggregate error can + hide later errors or drop a group (`INT-042`). The new one-group mode admits + only infallible built-ins over callback-free/data-error-free pipelines; fallible + aggregates retain today's full-drain behavior, including under Limit. +- Window returns rows in input order. Its shared evaluator supports peers, + deterministic row-number ties, lag/lead, row frames, and registered functions. +- ProbeValue can switch to either hash orientation while running. Joins and + binding expressions can replace already-bound cells. Projected Distinct + canonicalizes floats and set elements. + +## 1. Two order properties, tied to a particular comparator + +Add private engine metadata for: + +1. **Lexicographic order**: a sequence of slot/comparator/direction entries and + slots proved constant. Comparators distinguish encoded-id order, supported + scalar value order, and `Value::Ord` group order. Consumers explicitly require + the comparator they use; an id order is never presented as value order. +2. **Contiguous grouping/partition keys**: tuples whose equal values cannot + reappear after a different tuple, tagged explicitly with the consumer's + `Value::Ord` equality. This does + not imply semantic ascending order. Constants and repeated slots can be + removed when matching a requested key. A tuple prefix proves adjacency for + that prefix, not for an arbitrary suffix or subset. + +An Aggregate's complete grouping tuple additionally proves output uniqueness, +which can discharge later Sort tie columns once that entire tuple is matched. +Start conservatively: no general functional-dependency inference, index reversal, +statistics cache, schema/type annotation, or automatic merging of source runs. +Internal test fixtures may construct explicit proofs but production never trusts +a sample of rows. Unknown means use the existing operator. +For certified committed scalar/id slots, prove and test that `JoinKey::group` +classes coincide with `Value::Ord` classes before using the cell key as the +boundary test. Excluded string/set representations supply no such proof. Never +infer coarse-equality adjacency merely from a finer raw-key adjacency. + +## 2. Bind physical choices to the pinned snapshot + +The logical planner records order demand and legal physical alternatives. +Resolve these once for each Stream open, against its own snapshot/TxBound and +function registry. Prepared execution repeats that resolution; it does not reuse +an order claim from an earlier execution or checkpoint. Only the top-level plain +query pipeline is resolved; correlated/not/or bodies receive no order demand, +and `open_rules` keeps its current construction and strategies in this delivery. + +An index-derived guarantee requires a committed key source, no pending or staged +record in the affected scan range, and no derived run. Use existing +`Snapshot::pending_len()` (which includes staged facts) for the zero-record fast +check. Otherwise add a private existence probe over Snapshot's captured pending +index view, short-circuiting at the first in-range record; no full pending clone, +net-assert or TxBound filtering. Assertions/retractions from any time force +fallback for that range; unrelated pending attributes do not disable it. Cover +staged facts through the same view and never use the live store's current length. +Later writes/checkpoints cannot change the choice for that pinned snapshot. +Pending-only/in-memory and derived scans keep the current plan. + +The large-transaction `with_committed` path is eligible: `large_reader` exposes +the working MetaPage's complete four index roots and dictionary after finished +statements (`persistent_facts/large_tx.rs:218`, `:424`); it already incorporates +the prior pending store. Test read-own-writes, rejected statement rollback, +all index alternatives, and no stale proof across successive queries there. + +Reuse existing selective index choices. Add an AVET alternative for a source scan +with constant attribute and unbound value when downstream demand needs value +order/adjacency; its cost must be justified by removing a buffering operator. +Do not replace a more selective entity/exact-value range by a whole attribute +scan. No whole-database scan is introduced to prove an order. +Only the outermost source scan supplies initial properties; optimizer join +order is unchanged. Initially require an unbound value position, no repeated +variable across source positions, and exactly one committed key range. Literal +keyword/ref/float/set matches can read several ranges or encodings, so supply +no order certificate here. `[:E :a ?v]` can retain its existing selective EAVT +range and use an AVET attribute kind proof as a conservative superset; no switch +to a broader range is needed. + +For a single AVET attribute range, use at most a fixed number of raw +tag-prefix existence seeks through the Stream snapshot's own committed-reader +KeySource (the large transaction's working reader where applicable) to prove its values are +all one supported kind. Add an internal KeySource prefix-existence method backed +by a LeafCursor seek and at most one matching raw entry. Do not implement this +with `live_keys(max=1)`: finding no live key could walk arbitrarily many retracted +or excluded historical entries. Extend the internal kind-prefix helper as +necessary; do not hardcode byte tags in the planner. Only integers, booleans and canonical +committed floats initially prove scalar `value_order`. Empty input is trivially +ordered. Any other/multiple kind retains Sort. Over-approximating visibility is +safe: retracted/history keys and keys outside the transaction/valid-time filter +may cause fallback, never false proof. This trades optimization coverage for a +bounded number of tree seeks independently of historical data size. +I/O failure during optional proof reads abandons the optimization; the ordinary +query path remains authoritative for errors it would actually encounter. + +For Window partition adjacency, EAVT/AEVT id prefixes and AVET integer/boolean/keyword/ref +value prefixes can be useful without matching semantic value order. Exclude +float/set/long-string grouping components unless the precise equality-adjacency +claim is proved. A *single* committed float grouping/partition column is safe: +the two zero encodings are consecutive and all committed NaNs are canonical. +Do not certify multi-column float grouping. A mixture of integer and float tags +also matches `Value::Ord` grouping order (integers before floats), while it does +not match `value_order` for Sort. No long-string/set order is inferred. + +## 3. Propagation rules + +These rules refer to the actual implementation, not to an operator's name: + +| Operator | Initial rule | +|---|---| +| Filter, filtering Pseudo, Limit/Offset | Preserve properties on unchanged cells. | +| Bind New/Check, Pseudo Bind, CollectSet New/Check | Preserve properties on old unchanged slots; infer no order for new slots. | +| Bind Replace, CollectSet Replace, Join replacement | Truncate the guaranteed key prefix at the first changed component; clear affected adjacency claims. | +| Entity nested-loop probe | Outer rows are processed in sequence; preserve outer properties on unchanged outer slots. Infer no global order for new inner slots. | +| ProbeValue | Preserve an outer guarantee only if every possible fallback streams the outer in sequence (`build_inner=true`); otherwise clear it. | +| Hash join | Initially clear all guarantees, even if one orientation could preserve a prefix. | +| AntiJoin | Preserve unchanged outer properties; initially do not push a new index demand through a callback-containing body. | +| Union | Initially clear properties, despite its current outer-major implementation. | +| Distinct | Preserve properties on untouched slots; canonicalization in DistinctFind invalidates affected prefixes unless a specific monotonic/equality proof exists. | +| Hash Aggregate | Clear optimization proofs in this delivery; its output uses `Value::Ord`, which alone cannot satisfy Sort's different comparator. | +| Streaming Aggregate | Remap its certified scalar group domain/order to the output group slot, and mark that complete key unique. Convert to `value_order` only for one supported scalar kind, never mixed integers/floats. | +| Window | Preserve properties only on unchanged kept input slots; no inferred order for window results. | +| Sort | Establish its actual full `value_order` key on remapped output slots. | + +Any query subtree containing user callbacks retains its existing physical access +order, Sort, and materialized aggregate/window behavior in this delivery. Disable +every #641 strategy for such a pipeline, even if no source index would change. +Resolve this +by registry implementation descriptors and recursive expression/body traversal, +not by guessed names or text matching. Rule-derived input remains a fallback. +Do not reuse plan::udfs as a complete detector: it sees only top-level unary +UDF clauses. Traverse nested expressions, bind clauses, nested not/or bodies, +aggregate descriptors and WindowFunc::Udf explicitly. +CollectSet also disables access reordering and early-stopping strategies in its +containing pipeline: its `QRY-015` data error must not disappear behind Limit. +Apply this restriction recursively through not/or bodies and rule plans. + +## 4. Sort omission + +No user callback or CollectSet may occur anywhere in the optimized top-level +pipeline or its nested bodies. If either occurs, keep Sort and the original +access path, even under Limit. + +At the final Sort decision, translate every full-order column through `plan.find` +to its producing slot. Remove only proved constants and repeated slots. Omit +Sort only when the remaining complete lexicographic order follows from the input +proof with matching comparator and directions. A stronger input key can satisfy +a prefix of itself; an unrequested leading key cannot be ignored. +Once a complete unique grouping tuple is matched, later columns cannot change +the relative order of any groups and require no further ordering proof. + +At open-time removal of `Step::Sort`, restore `plan.find = Sort.cols`: the logical +planner has already moved the original slots there and remapped `find` to +`0..find.len()`. Simply deleting the step would project the wrong slots. The +resolver must restore that mapping even with a following Limit. Limit/Offset remains above the chosen child. No descending +index scan is added. A missing proof keeps today's full Sort or top-k heap. + +Positive example: a committed integer attribute, `[:find ?v :where [?e :score ?v] +:order-by [?v] :limit 10]`, can read AVET and stop after the required batches. +Counterexample: adding `?e` to `:find` requires UUID tie order and keeps Sort; +DICT entity ids do not satisfy that suffix. Mixed integer/float values also +keep Sort despite looking numeric. + +Omitting Sort allows a cursor to return batches before a later IO/allocation +error, and Limit can avoid errors in unread input. This is ordinary cursor +laziness, not a promise to validate unread storage. User callbacks and CollectSet +disable omission; fallible materialized Aggregate still drains/validates before +returning any row. Test both callback counts and later data-error propagation. + +## 5. One-group Aggregate without hiding data errors + +Use streaming only when there is exactly one grouping column, `:with` is empty, +the query has no window, input is proved increasing by that column under +`Value::Ord`, and every aggregate's descriptor is built-in `count` or +`count-distinct`. These finish without an `INT-041/043/044` data error for arbitrary +argument values (`Agg::finish`); count-distinct retains its existing set growth +and allocation errors. Exclude callbacks and CollectSet throughout the input +pipeline, with or without a Limit. + +Initially certify integer, boolean or canonical committed-float group columns, +and mixed integer/float columns (the tag order matches `Value::Ord`). Do not +stream DICT-ordered entity/keyword groups merely because they are adjacent: +their output would violate the existing semantic group order. Multi-column +grouping, `:with`, sum/sum-distinct/min/max, registered aggregates, and unknown +order keep the existing hash-grouped strategy. Ungrouped behavior is unchanged. +Grouped `avg` is not supported by the current parser/Agg implementation; this +optimization adds no aggregate function. Window `avg` remains supported. + +Retain one group's representative cells and existing `Acc`s, an input batch and +position, and a bounded output batch. Compare boundaries by group equality, +so both zero signs stay in one group. Finish a group, append its result to the +output batch, and release its state before starting the next. Output follows +the same `Value::Ord` key order and float representative choice as today's hash +path. Reuse a one-group finish helper and preserve empty/zero-row rules. Do not +retain all finished results. Limit can stop after its final group, with the +usual batch/lookahead overread. + +Memory is one group's accumulators/distinct members and bounded input/output +batches, independent of completed group count. A single huge count-distinct +group can still grow. IO/allocation errors may follow batches already returned +to a cursor, as its contract allows; execute returns an error on full drain. +No aggregate data error can be hidden: fallible aggregates retain full drain. + +## 6. Partition-at-a-time Window + +Use a partition strategy when all windows have the same nonconstant +`:partition-by` input slot, that slot has group-equality adjacency, and the +affected subtree contains no user callbacks. Windows without a partition, mixed +partition keys or unknown adjacency keep today's full-input strategy. CollectSet +also forces fallback. Initially exclude aggregate queries from this strategy, +keeping the combination of strategy changes bounded in scope. + +Hold the current partition's kept cells and named values, plus a bounded +lookahead batch and row position. On a boundary, invoke the existing `windows` +evaluator for that partition, including each window's own sort/peers/frame, +then return its rows in original input order. Emit/release its result columns +before retaining the next complete partition. Reset rank, row-number, running +aggregates, neighbor reads and row frames at every boundary. An empty partition +is never emitted; partition boundaries crossing batches work the same way. + +No retained full-query position vector, result list or partition index. The +partition operator's memory is O(largest partition), output batches and existing +window state; a surrounding Sort/Distinct/Aggregate can still dominate query +memory. A Limit may stop before later partitions; this is an expected benefit +for built-in window pipelines. UDF windows/predicates/aggregates and unproved +paths retain their current behavior. I/O/allocation errors occur when the cursor +pulls the corresponding input, as for other streaming operators. + +Without a final query `:order-by`, row order is unspecified across physical +plans, as with current optimizer reordering. An AVET alternative can change that +encounter order; Window preserves its chosen input's order, with the same answer +bag and window values. Compare lists for a fixed chosen input order and bags +across index alternatives unless an explicit final order is requested. + +Retain DICT caches for a whole query only for the existing full-input Window +strategy. Partition windows allow normal `IdSpace::end_pull` eviction; ids and +value-page references remain valid under the pinned snapshot. Test per-query +IdSpace peak as well as Window's own meter: a bounded operator with an unbounded +cache is not accepted as bounded query memory. +Streaming Aggregate and partition Window also evict transient DICT lookup caches +at safe internal child-batch boundaries; waiting for Stream::next_rows alone is +insufficient when a single operator pull consumes many input batches. This never +evicts provisional ids or invalidates retained Cell ids/value references. + +## 7. Accounting and lifecycle + +Charge retained batches/lookahead, keys, accumulator/distinct members, result +rows, partition values and window columns through existing Held/Meter paths. +Charge before growth; failed `try_reserve` reports `QRY-012`. Transfers between +buffers are charged once for the actual live ownership. Accounting continues +through errors, partial pulls, rewind, close and drop. The profiler is not yet +public; private test strategy markers/counters distinguish choices for tests and #185. +No production feature/config switch is added. + +## 8. Required correctness tests + +- Forced optimized/fallback strategies over the exact same snapshot: compare + ordered lists (including float bits), unordered bags and error codes. Use a + private/test-hooks switch, not a public API. No removed executor oracle. + Frozen answer digests compare bags and are an additional regression guard, + never the ordered oracle; do not re-bless tests/answers for this optimization. +- Sort positive and fallback examples, repeated projected columns/constants, + complete tie suffixes, descending keys, mixed numeric kinds, NaNs/zeros, + scrambled DICT allocation, long strings sharing prefixes, sets and nil. +- Proofs operate on full ranges, not first-row samples. Put a disqualifying kind + late in an attribute, in historical data, or outside current valid time. +- Reopen prepared queries before/after pending writes and checkpoint; in-range + mixed/pending/staged and rule-derived paths use fallback; unrelated pending + attributes and large-transaction working snapshots exercise eligible paths. Open cursor + keeps its result while another writer checkpoints/reuses pages. +- Join preservation and invalidation, particularly replacements and a mid-run + ProbeValue fallback that builds the outer. Canonicalizing Distinct and nested + not/or bodies cannot accidentally resurrect a discarded proof. +- Streaming groups spanning batches, nil/empty groups and zero row, counts over + arbitrary argument kinds, signed-zero representatives and distinct release. + Fallible aggregates, `:with` and multi-key grouping retain materialized behavior: + a semantic earlier error encountered last, dropped-group aggregate precedence, + upstream failures and invalid groups after a limited prefix retain their errors. + UDF callback sequences and CollectSet failures remain unchanged. +- Window partition boundaries at and across batches, one huge/many small + partitions, all built-ins including lag/lead and bounded row frames, peers, + multiple compatible windows, incompatible/unpartitioned fallbacks, input-order + preservation and Limit/Offset. Include id-heavy retained rows. +- Every holder and IdSpace releases memory on success/error/close/drop/rewind. + Enforce small-worker-stack, binary-size and portable-target gates. + +At group/partition boundaries validate monotonicity with the physical/semantic +comparator carried by the certificate; a violation fails with existing INT-032, +never falls back after emitting rows. This is a defensive check, not permission +to weaken planner proofs. Include injected out-of-order operator fixtures. + +## 8.1 Acceptance gates + +- On the positive ordered scalar fixture, scan rows read are at most + `offset + limit + BATCH_ROWS`; zero limit reads no facts. Streaming aggregate + group-limit reads at most all rows of the requested groups plus one input + batch, with maximum fixture group size stated. No proof reads occur with no + applicable consumer demand, measured by counters rather than timings. +- On fixed-size partitions/groups at 100K/1M/10M committed facts, streaming + Window/Aggregate and transient IdSpace peak must stay within the 100K peak plus + two maximally-sized charged input batches. Compute that allowance using the + test fixture's cell/row byte helpers. No finished-results list is allowed. + Distinct members within a growing single group and a growing single Window + partition are explicitly linear controls, not bounded-memory claims. +- In query-only subprocess measurements on prebuilt fixtures, peak RSS at 10M + must be within the 100K baseline plus max(16 MiB, 15%). Investigate any failure + using engine holder/IdSpace peaks; do not count fixture-building memory as + query memory. Existing buffering paths need no claim of flat memory. +- For the bounded positive limit fixtures, 10M median query time is at most + twice 100K after warmup, with at least five idle-machine A/B samples. Existing + #379 point-query medians must not regress by more than 5%; investigate noise + before trusting either result. Include proof-startup cost as a separate case. +- Required tests/coverage/portability checks pass, the 1,230 KiB release binary + cap remains unchanged, and frozen answers are unchanged. Run an optimized + committed-memory-backend fixture on WASI and a corresponding browser fixture + where its runner is available, rather than exercising only in-memory fallback. + +## 9. Measurement and delivery + +Three dependent PRs to `v3`: (1) order metadata, conservative scan choices and +Sort omission; (2) streaming Aggregate; (3) partition Window and cache lifetime. +Keep #641 open until all three land; do not close #473. No release/tag bump. +Specs/plans and the exact fallback scope accompany PR 1. +Unique-group Sort omission lands with streaming Aggregate in PR 2; PR 1 does +not infer a Sort-compatible order from the existing hash Aggregate. + +Run all Cargo tests, clippy, coverage and measurements on the designated idle +bench machine first. Non-timing checks use the whole machine; timing runs use +the established NUMA A/B protocol with immutable base/PR revisions and at least +five samples after warmup. Keep private machine details out of committed docs. +Record command, revision, workload, engine peak, RSS, median and range. + +At 100K, 1M and 10M committed facts: ordered value-only limit/offset versus Sort +fallback (scan counters establish early stopping); high-cardinality grouped +count/count-distinct (one active group, bounded output batches, and +materialized sum-distinct as a fallback control); fixed-size Window partitions with total rows growing +(Window/IdSpace peak bounded by partition size); one growing partition (document +linear bound). Include mixed/pending, tie-suffix and type fallbacks as controls. +Run the relevant existing envelope and #379 point-query guards, avoiding timing +claims from the laptop. Review proof-seek overhead on small/selective queries; +ordinary queries without an applicable demand should perform no proof reads. + +Record benchmark IDs/filter coverage for #776; adding a benchmark is not evidence +that the nightly filter runs it. Reuse existing CI routes where sufficient; +coordinate shared workflow changes on both release branches if needed. + +Synchronize affected architecture/status/perf documentation across CLAUDE.md, +ROADMAP.md, README.md, CHANGELOG.md and docs/TEST_COVERAGE.md. Update the docs site +architecture description in its own PR with `@since v3.0.0` if release targeting +remains as currently assigned; cross-check the reference/comparison/use-cases +pages and change only claims affected by this work. No new syntax/error entries. +Claude reviews each code slice and the combined evidence before PR creation. +Delete task-created remote scratch after runs unless explicitly reused, report +anything retained and why; do not remove preexisting shared caches or fixtures. diff --git a/examples/perf_envelope.rs b/examples/perf_envelope.rs index ff4c4427a2..3b168722a0 100644 --- a/examples/perf_envelope.rs +++ b/examples/perf_envelope.rs @@ -672,6 +672,13 @@ fn shapes(e: usize, tx_half: u64, tx_half_time: &str, hot_tx_half: u64) -> Vec + +use minigraf::Minigraf; +use std::path::Path; + +fn main() { + let args: Vec<_> = std::env::args().collect(); + let path = Path::new(&args[1]); + let depth: usize = args[2].parse().unwrap(); + assert!(depth > 0 && !path.exists(), "use a fresh fixture path"); + let db = Minigraf::open(path).unwrap(); + for i in 0..2000 { + db.execute(&format!("(transact [[:f/{i} :x {i}]])")) + .unwrap(); + } + db.execute("(transact [[:e/hot :other \"o\"]])").unwrap(); + db.execute("(transact {:valid-from \"2020-01-01T00:00:00Z\"} [[:e/hot :hash \"h0\"]])") + .unwrap(); + assert_eq!(db.current_tx_count(), 2002, "the as-of fixture boundary"); + for i in 1..depth { + db.execute(&format!("(retract [[:e/hot :hash \"h{}\"]])", i - 1)) + .unwrap(); + db.execute(&format!( + "(transact {{:valid-from \"2020-01-01T00:00:00Z\"}} [[:e/hot :hash \"h{i}\"]])" + )) + .unwrap(); + } + db.checkpoint().unwrap(); + drop(db); + println!( + "{{\"depth\":{depth},\"file_bytes\":{}}}", + std::fs::metadata(path).unwrap().len() + ); +} diff --git a/scripts/input_order_probe.rs b/scripts/input_order_probe.rs new file mode 100644 index 0000000000..f2990a56f1 --- /dev/null +++ b/scripts/input_order_probe.rs @@ -0,0 +1,50 @@ +//! Common query probe compiled against both comparison libraries for #641. +//! Usage: probe '' [zeros] +//! Build fixtures separately with perf_envelope __build. Open/thread creation +//! are excluded from timings; process RSS is query-only. Worker stack: 256 KiB. + +use minigraf::{OpenOptions, Value}; +use std::time::{Duration, Instant}; + +fn rss_kb() -> u64 { + std::fs::read_to_string("/proc/self/status") + .ok() + .and_then(|text| { + text.lines() + .find(|l| l.starts_with("VmHWM:")) + .and_then(|l| l.split_whitespace().nth(1)) + .and_then(|n| n.parse().ok()) + }) + .unwrap_or(0) +} + +fn main() { + let args: Vec<_> = std::env::args().collect(); + std::thread::Builder::new().stack_size(256 * 1024).spawn(move || { + let db = OpenOptions::new().read_only(true).path(&args[1]).open().unwrap(); + let expected: usize = args[3].parse().unwrap(); + let check_zeros = args.get(4).is_some_and(|s| s == "zeros"); + let drain = || { + let mut cursor = db.query(&args[2]).unwrap(); + let mut rows = 0; + while let Some(batch) = cursor.next_batch(1000).unwrap() { + rows += batch.len(); + if check_zeros { + assert!(batch.rows().iter().all(|r| r == &[Value::Integer(0)]), "expected ordered age zeros"); + } + } + assert_eq!(rows, expected, "expected row count"); + }; + for _ in 0..3 { drain(); } + let start = Instant::now(); + let mut times = Vec::new(); + while times.len() < 20_000 && (times.len() < 5 || start.elapsed() < Duration::from_secs(1)) { + let t = Instant::now(); + drain(); + times.push(t.elapsed().as_secs_f64() * 1_000_000.0); + } + times.sort_by(f64::total_cmp); + println!("{{\"runs\":{},\"median_us\":{:.3},\"min_us\":{:.3},\"max_us\":{:.3},\"rows\":{},\"peak_rss_kb\":{}}}", + times.len(), times[times.len() / 2], times[0], times[times.len()-1], expected, rss_kb()); + }).unwrap().join().unwrap(); +} diff --git a/src/graph/storage.rs b/src/graph/storage.rs index 87790470b7..2ca3407cc1 100644 --- a/src/graph/storage.rs +++ b/src/graph/storage.rs @@ -302,6 +302,34 @@ impl Snapshot { .saturating_add(self.staged.as_ref().map_or(0, |s| s.facts.len())) } + /// Any pending/staged record of this attribute (and optional entity) in + /// the captured snapshot, even a retraction or excluded version (#641). + pub(crate) fn has_pending(&self, attribute: &str, entity: Option<&EntityId>) -> Result { + use crate::storage::index::AevtKey; + if self.pending_len() == 0 { + return Ok(false); + } + let pending = self.read_pending()?; + let mut start = AevtKey::attribute_start(attribute); + if let Some(e) = entity { + start.entity = *e; + } + // Existence needs no merge: stop each index at the source boundary + // before filtering records appended after the captured prefix. + let has = |store: &PendingStore, len: usize| { + store + .indexes + .aevt + .range(&start..) + .take_while(|(k, _)| { + k.attribute == attribute && entity.is_none_or(|e| k.entity == *e) + }) + .any(|(_, &pos)| pos < len) + }; + Ok(has(&pending, self.pending_len) + || self.staged.as_ref().is_some_and(|s| has(s, s.facts.len()))) + } + /// This snapshot with `facts` staged after its pending ones (#550 spec /// §7), its `now` raised to the newest of their `tx_id`s. pub(crate) fn with_staged(mut self, facts: Vec) -> Self { diff --git a/src/lib.rs b/src/lib.rs index 59f1e45fa0..ae678daa68 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -140,6 +140,18 @@ pub fn __reorder(on: bool) -> ReorderGuard { query::datalog::optimizer::set_reorder(on) } +#[cfg(feature = "test-hooks")] +#[doc(hidden)] +pub use query::engine::InputOrderGuard; + +/// Enables input-order optimizations on this thread for differential tests. +/// The previous setting is restored on drop; test-hooks builds only. +#[cfg(feature = "test-hooks")] +#[doc(hidden)] +pub fn __input_order(on: bool) -> InputOrderGuard { + query::engine::set_input_order(on) +} + // Large-transaction tests (#550): statements read and written in small chunks. #[cfg(feature = "test-hooks")] #[doc(hidden)] diff --git a/src/query/datalog/aggregate.rs b/src/query/datalog/aggregate.rs index 8e5c6619fb..367776178a 100644 --- a/src/query/datalog/aggregate.rs +++ b/src/query/datalog/aggregate.rs @@ -55,8 +55,10 @@ pub(crate) fn value_order(a: &Value, b: &Value) -> Ordering { (Value::Set(x), Value::Set(y)) => { let mut xs: Vec<&Value> = x.iter().collect(); let mut ys: Vec<&Value> = y.iter().collect(); - xs.sort_by(|p, q| value_order(p, q)); - ys.sort_by(|p, q| value_order(p, q)); + // Share one comparator type, so both sides share the sort code. + let cmp = |p: &&Value, q: &&Value| value_order(p, q); + xs.sort_by(cmp); + ys.sort_by(cmp); xs.iter() .zip(&ys) .map(|(p, q)| value_order(p, q)) @@ -845,15 +847,13 @@ pub(crate) fn windows( }) .then(a.cmp(&b)) }; - if let Some(partition_col) = part { - keyed.sort_unstable_by(|&a, &b| { - read(a, Some(partition_col)) - .cmp(read(b, Some(partition_col))) - .then_with(|| row_cmp(a, b)) - }); - } else { - keyed.sort_unstable_by(|&a, &b| row_cmp(a, b)); - } + // One sort implementation for partitioned and unpartitioned windows. + keyed.sort_unstable_by(|&a, &b| { + part.map_or(Ordering::Equal, |col| { + read(a, Some(col)).cmp(read(b, Some(col))) + }) + .then_with(|| row_cmp(a, b)) + }); // Charge slots before allocating, then payloads as each slot is // filled. The outer vector's entry stays charged until it is dropped. diff --git a/src/query/engine/mod.rs b/src/query/engine/mod.rs index 4d895d862e..c85080d7c6 100644 --- a/src/query/engine/mod.rs +++ b/src/query/engine/mod.rs @@ -14,6 +14,9 @@ mod ids; mod join; mod limit; mod meter; +mod order; +#[cfg(all(test, not(target_arch = "wasm32")))] +mod order_tests; mod plan; mod project; mod recursive; @@ -36,6 +39,10 @@ use anyhow::Result; use batch::Batch; use ids::IdSpace; pub(crate) use meter::Meter; +#[cfg(feature = "test-hooks")] +pub use order::InputOrderGuard; +#[cfg(feature = "test-hooks")] +pub(crate) use order::set_enabled as set_input_order; pub(crate) use plan::{Plan, plan, plan_rules, udfs}; pub(crate) use recursive::Limits; use std::sync::Arc; @@ -162,13 +169,14 @@ fn keys(snapshot: &Snapshot) -> Result> { /// Open `plan` over `snapshot`, holding at most `memory_limit` bytes. pub(crate) fn open( snapshot: Snapshot, - plan: Plan, + mut plan: Plan, functions: Arc, memory_limit: usize, ) -> Result { let keys = keys(&snapshot)?; let meter = Meter::new(memory_limit); let bound = resolve(&snapshot, plan.as_of, &meter)?; + order::resolve(&snapshot, keys, &functions, &mut plan); let ids = IdSpace::new(keys, &meter); Ok(stream(snapshot, ids, plan, functions, None, meter, bound)) } diff --git a/src/query/engine/order.rs b/src/query/engine/order.rs new file mode 100644 index 0000000000..b0d0faa053 --- /dev/null +++ b/src/query/engine/order.rs @@ -0,0 +1,330 @@ +//! Snapshot-bound input-order proofs (#641). DICT order is never UUID/text +//! order. Unknown order retains the original index choice and buffering. + +use super::plan::{Body, JoinKind, Meta, Out, Plan, ScanSpec, Source, Step, Term, Vars}; +use crate::graph::storage::Snapshot; +use crate::query::datalog::functions::{AggImpl, FunctionRegistry}; +use crate::query::datalog::types::{Expr, FindSpec, UnaryOp, WindowFunc}; +use crate::storage::KeySource; +use crate::storage::keys::{self, Index, ValueKind}; +use anyhow::Result; + +#[cfg(any(test, feature = "test-hooks"))] +thread_local! { + static ENABLED: std::cell::Cell = const { std::cell::Cell::new(true) }; +} + +#[cfg(test)] +thread_local! { + /// Public write-transaction reads return rows rather than a cursor; tests + /// use this marker to verify which root strategy they actually opened. + pub(super) static OPTIMIZATIONS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +fn enabled() -> bool { + #[cfg(any(test, feature = "test-hooks"))] + return ENABLED.with(std::cell::Cell::get); + #[cfg(not(any(test, feature = "test-hooks")))] + true +} + +/// Force the original strategy for differential tests only. +#[cfg(any(test, feature = "test-hooks"))] +pub(crate) fn set_enabled(on: bool) -> InputOrderGuard { + InputOrderGuard(ENABLED.with(|v| v.replace(on))) +} + +#[cfg(any(test, feature = "test-hooks"))] +#[must_use = "input-order optimization is restored when the guard drops"] +/// Restores this thread's previous input-order test setting on drop. +pub struct InputOrderGuard(bool); + +#[cfg(any(test, feature = "test-hooks"))] +impl Drop for InputOrderGuard { + fn drop(&mut self) { + ENABLED.with(|v| v.set(self.0)); + } +} + +/// Only the leading scalar slot has a semantic comparator. The following +/// entity key is DICT order and cannot prove any Sort column in this slice. +struct Ordering { + slot: Option, + kind: ValueKind, + constants: Vec, +} + +impl Ordering { + fn source(spec: &ScanSpec, kind: ValueKind) -> Self { + Ordering { + slot: match spec.v { + Term::Bind(s) => Some(s), + _ => None, + }, + kind, + constants: spec + .meta + .iter() + .filter_map(|&(m, s)| (m == Meta::ValidAt).then_some(s)) + .collect(), + } + } + + fn invalidate(&mut self, slot: usize) { + if self.slot == Some(slot) { + self.slot = None; + } + self.constants.retain(|&s| s != slot); + } + + fn constant(&self, expr: &Expr, vars: &Vars) -> bool { + match expr { + Expr::Lit(_) => true, + Expr::Var(v) => vars + .iter() + .any(|(name, s)| name == v && self.constants.contains(s)), + Expr::BinOp(_, a, b) => self.constant(a, vars) && self.constant(b, vars), + Expr::UnaryOp(_, a) => self.constant(a, vars), + Expr::Slot(_) | Expr::CollectSet { .. } => false, + } + } + + fn through(mut self, steps: &[Step]) -> Option { + for step in steps { + match step { + Step::Filter(..) | Step::Anti(_) | Step::Distinct(_) | Step::Limit { .. } => {} + Step::Bind(expr, vars, slot, mode) => { + let constant = self.constant(expr, vars); + if *mode == Out::Replace { + self.invalidate(*slot); + } + if *mode != Out::Check && constant { + self.constants.push(*slot); + } + } + Step::Pseudo { col, value } => { + if let Term::Bind(slot) = value + && self.constants.contains(col) + { + self.constants.push(*slot); + } + } + Step::Join(join) => { + if !matches!( + join.kind, + JoinKind::Probe(_) + | JoinKind::ProbeValue { + build_inner: true, + .. + } + ) { + return None; + } + for &(_, slot) in &join.replace { + self.invalidate(slot); + } + } + Step::DistinctFind(slots) => { + if self.kind == ValueKind::Float + && let Some(slot) = self.slot.filter(|s| slots.contains(s)) + { + self.invalidate(slot); + } + } + Step::Union(_) + | Step::CollectSet(_) + | Step::Aggregate { .. } + | Step::Window { .. } + | Step::Sort { .. } => return None, + } + } + Some(self) + } + + fn satisfies(&self, cols: &[usize], order: &[(usize, bool)]) -> bool { + let mut matched = false; + for &(column, desc) in order { + let Some(&slot) = cols.get(column) else { + return false; + }; + if self.constants.contains(&slot) || (matched && self.slot == Some(slot)) { + continue; + } + if matched + || desc + || self.slot != Some(slot) + || !matches!( + self.kind, + ValueKind::Integer | ValueKind::Float | ValueKind::Boolean + ) + { + return false; + } + matched = true; + } + matched + } +} + +fn safe_expr(expr: &Expr) -> bool { + match expr { + Expr::UnaryOp(UnaryOp::Udf(_), _) | Expr::CollectSet { .. } => false, + Expr::UnaryOp(_, a) => safe_expr(a), + Expr::BinOp(_, a, b) => safe_expr(a) && safe_expr(b), + Expr::Lit(_) | Expr::Var(_) | Expr::Slot(_) => true, + } +} + +fn safe_find(find: &[FindSpec], functions: &FunctionRegistry) -> bool { + find.iter().all(|f| match f { + FindSpec::Variable(_) => true, + FindSpec::Aggregate { func, .. } => functions + .get(func) + .is_some_and(|d| matches!(d.impl_, AggImpl::Builtin(_))), + FindSpec::Window(w) => !matches!(w.func, WindowFunc::Udf(_)), + }) +} + +fn safe_body(body: &Body, functions: &FunctionRegistry) -> bool { + match body { + Body::Correlated { plan, .. } | Body::Hashed { plan, .. } => { + safe_steps(&plan.steps, functions) + } + } +} + +fn safe_steps(steps: &[Step], functions: &FunctionRegistry) -> bool { + steps.iter().all(|s| match s { + Step::Filter(expr, _) | Step::Bind(expr, ..) => safe_expr(expr), + Step::CollectSet(_) => false, + Step::Anti(body) => safe_body(body, functions), + Step::Union(branches) => branches.iter().all(|b| safe_body(&b.body, functions)), + Step::Aggregate { aggs, .. } => aggs.iter().all(|(func, _)| { + functions + .get(func) + .is_some_and(|d| matches!(d.impl_, AggImpl::Builtin(_))) + }), + Step::Window { find, .. } => safe_find(find, functions), + Step::Pseudo { .. } + | Step::Join(_) + | Step::Distinct(_) + | Step::DistinctFind(_) + | Step::Sort { .. } + | Step::Limit { .. } => true, + }) +} + +/// At most eight raw seeks through the exact reader the Stream will scan. +fn scalar_kind(keys: &dyn KeySource, attribute: u32) -> Result> { + let mut found = None; + for kind in ValueKind::ALL { + if keys.any_key(Index::Avet, &keys::attribute_kind_prefix(attribute, kind))? { + if found.is_some() { + return Ok(None); + } + found = Some(kind); + } + } + Ok(found.filter(|k| { + matches!( + k, + ValueKind::Integer | ValueKind::Float | ValueKind::Boolean + ) + })) +} + +fn candidate( + snapshot: &Snapshot, + keys: &dyn KeySource, + plan: &Plan, +) -> Result> { + let Source::Scan(spec) = &plan.source else { + return Ok(None); + }; + let (Term::Const(attribute), Term::Bind(_)) = (&spec.a, &spec.v) else { + return Ok(None); + }; + if spec.derived.is_some() || spec.never() || matches!(spec.e, Term::Eq(_)) { + return Ok(None); + } + let Some(at) = plan + .steps + .iter() + .position(|s| matches!(s, Step::Sort { .. })) + else { + return Ok(None); + }; + let Some(Step::Sort { cols, order, keep }) = plan.steps.get(at) else { + return Ok(None); + }; + if *keep == Some(0) { + return Ok(None); + } + let Some(before) = plan.steps.get(..at) else { + return Ok(None); + }; + // Reject impossible full orders before any speculative storage reads. + if !Ordering::source(spec, ValueKind::Integer) + .through(before) + .is_some_and(|p| p.satisfies(cols, order)) + { + return Ok(None); + } + let entity = match &spec.e { + Term::Const(e) => Some(e), + _ => None, + }; + if snapshot.has_pending(attribute, entity)? { + return Ok(None); + } + let Some(a) = keys.iid_of(attribute)? else { + return Ok(None); + }; + let Some(kind) = scalar_kind(keys, a)? else { + return Ok(None); + }; + if !Ordering::source(spec, kind) + .through(before) + .is_some_and(|p| p.satisfies(cols, order)) + { + return Ok(None); + } + Ok(Some((at, !matches!(spec.e, Term::Const(_))))) +} + +/// Only a plain query's root pipeline is resolved; bodies and rules keep their +/// original strategies. Failed optional proof reads retain the original plan. +pub(super) fn resolve( + snapshot: &Snapshot, + keys: Option<&dyn KeySource>, + functions: &FunctionRegistry, + plan: &mut Plan, +) { + // With an offset, Sort.keep can be nonzero even though Limit pulls no row. + if !enabled() + || matches!(plan.steps.last(), Some(Step::Limit { limit: Some(0), .. })) + || !safe_steps(&plan.steps, functions) + { + return; + } + let Some(keys) = keys else { + return; + }; + let Ok(Some((at, avet))) = candidate(snapshot, keys, plan) else { + return; + }; + if !matches!(plan.steps.get(at), Some(Step::Sort { .. })) { + return; + } + if let Step::Sort { cols, .. } = plan.steps.remove(at) { + plan.find = cols; + } + if avet && let Source::Scan(spec) = &mut plan.source { + spec.index = Some(Index::Avet); + } + #[cfg(test)] + OPTIMIZATIONS.with(|n| n.set(n.get() + 1)); +} + +#[cfg(test)] +mod tests; diff --git a/src/query/engine/order/tests.rs b/src/query/engine/order/tests.rs new file mode 100644 index 0000000000..fbc0220f8b --- /dev/null +++ b/src/query/engine/order/tests.rs @@ -0,0 +1,280 @@ +use super::*; +use crate::Value; +use crate::query::engine::plan::{CollectSpec, JoinSpec, Valid}; + +fn spec(wildcard: bool) -> ScanSpec { + ScanSpec { + index: None, + e: if wildcard { Term::Any } else { Term::Bind(0) }, + a: Term::Const(":score".into()), + v: Term::Bind(1), + meta: vec![(Meta::ValidAt, 2)], + valid: Valid::Any, + width: 3, + derived: None, + } +} + +fn proof(kind: ValueKind) -> Ordering { + Ordering::source(&spec(false), kind) +} +fn sorted(proof: &Ordering) -> bool { + proof.satisfies(&[1], &[(0, false)]) +} +fn join(kind: JoinKind, replace: Vec<(usize, usize)>) -> Step { + Step::Join(JoinSpec { + inner: spec(false), + kind, + keys: vec![], + new: vec![], + replace, + outer_width: 3, + }) +} + +#[test] +fn full_order_requires_matching_prefix_direction_and_semantic_comparator() { + let order = proof(ValueKind::Integer); + assert!(sorted(&order)); + assert!( + order.satisfies(&[1, 1], &[(0, false), (1, false)]), + "same slot twice" + ); + assert!( + order.satisfies(&[2, 1], &[(0, true), (1, false)]), + "a leading constant can descend" + ); + assert!(!order.satisfies(&[1], &[(0, true)]), "no descending range"); + assert!( + !order.satisfies(&[1, 0], &[(0, false), (1, false)]), + "DICT order is not UUID order" + ); + let wildcard = Ordering::source(&spec(true), ValueKind::Integer); + assert!(sorted(&wildcard)); + assert!(!wildcard.satisfies(&[1, 0], &[(0, false), (1, false)])); + assert!( + !order.satisfies(&[], &[(0, false)]), + "malformed mapping is no proof" + ); +} + +#[test] +fn only_probe_fallbacks_that_stream_the_outer_keep_order() { + for kind in [ + JoinKind::Probe(0), + JoinKind::ProbeValue { + key: 0, + build_inner: true, + }, + ] { + assert!(sorted( + &proof(ValueKind::Integer) + .through(&[join(kind, vec![])]) + .unwrap() + )); + } + for kind in [ + JoinKind::Hash { build_inner: true }, + JoinKind::Hash { build_inner: false }, + JoinKind::ProbeValue { + key: 0, + build_inner: false, + }, + ] { + assert!( + proof(ValueKind::Integer) + .through(&[join(kind, vec![])]) + .is_none() + ); + } + let suffix = proof(ValueKind::Integer) + .through(&[join(JoinKind::Probe(0), vec![(1, 0)])]) + .unwrap(); + assert!( + sorted(&suffix), + "replacing the later entity cuts only that suffix" + ); + assert_eq!(suffix.slot, Some(1)); + let first = proof(ValueKind::Integer) + .through(&[join(JoinKind::Probe(0), vec![(0, 1)])]) + .unwrap(); + assert!(!sorted(&first), "replacing the value removes its proof"); +} + +#[test] +fn expression_modes_and_pseudo_bindings_handle_constants_and_replacements() { + let lit = Expr::Lit(Value::Integer(42)); + let new = proof(ValueKind::Integer) + .through(&[Step::Bind(lit.clone(), vec![], 3, Out::New)]) + .unwrap(); + assert!(new.satisfies(&[3, 1], &[(0, true), (1, false)])); + let checked = proof(ValueKind::Integer) + .through(&[Step::Bind(lit.clone(), vec![], 1, Out::Check)]) + .unwrap(); + assert!(sorted(&checked)); + assert!( + !checked.constants.contains(&1), + "join-equal checks do not prove an identical constant" + ); + let replaced = proof(ValueKind::Integer) + .through(&[Step::Bind(lit, vec![], 1, Out::Replace)]) + .unwrap(); + assert!(replaced.constants.contains(&1)); + assert!(replaced.slot.is_none()); + let replaced = proof(ValueKind::Integer) + .through(&[Step::Bind( + Expr::Var("?e".into()), + vec![("?e".into(), 0)], + 1, + Out::Replace, + )]) + .unwrap(); + assert!(!sorted(&replaced)); + assert!(!replaced.constants.contains(&1)); + let pseudo = proof(ValueKind::Integer) + .through(&[Step::Pseudo { + col: 2, + value: Term::Bind(3), + }]) + .unwrap(); + assert!( + pseudo.satisfies(&[3, 1], &[(0, true), (1, false)]), + "valid-at is constant, including nil" + ); +} + +#[test] +fn canonicalization_and_buffering_operators_cannot_supply_false_certificates() { + let int = proof(ValueKind::Integer) + .through(&[Step::DistinctFind(vec![1])]) + .unwrap(); + assert!(sorted(&int)); + let float = proof(ValueKind::Float) + .through(&[Step::DistinctFind(vec![1])]) + .unwrap(); + assert!(!sorted(&float)); + for step in [ + Step::Union(vec![]), + Step::CollectSet(CollectSpec { + entity: 0, + attribute: ":a".into(), + inner: spec(false), + out: 3, + mode: Out::New, + }), + Step::Aggregate { + groups: vec![1], + aggs: vec![("count".into(), 0)], + zero_row: false, + }, + Step::Window { + find: vec![], + named: vec![], + keep: vec![1], + }, + Step::Sort { + cols: vec![1], + order: vec![(0, false)], + keep: None, + }, + ] { + assert!( + proof(ValueKind::Integer).through(&[step]).is_none(), + "unsupported step clears proof" + ); + } +} + +/// No file or native-only API: WASI/browser tests exercise a real committed +/// reader and the optimized projection, not just the pending-store fallback. +#[cfg_attr( + all(target_arch = "wasm32", not(target_os = "wasi")), + wasm_bindgen_test::wasm_bindgen_test +)] +#[cfg_attr(not(all(target_arch = "wasm32", not(target_os = "wasi"))), test)] +fn committed_memory_backend_orders_all_supported_scalar_edge_cases() { + use crate::query::datalog::{ + aggregate::value_order, parser::parse_datalog_command, types::DatalogCommand, + }; + use crate::storage::{backend::memory::MemoryBackend, persistent_facts::PersistentFactStorage}; + for values in [ + vec![ + Value::Integer(i64::MAX), + Value::Integer(0), + Value::Integer(i64::MIN), + Value::Integer(-1), + ], + vec![ + Value::Boolean(true), + Value::Boolean(false), + Value::Boolean(true), + ], + vec![ + Value::Float(f64::NAN), + Value::Float(-f64::NAN), + Value::Float(f64::INFINITY), + Value::Float(f64::NEG_INFINITY), + Value::Float(-0.0), + Value::Float(0.0), + Value::Float(1.5), + ], + ] { + let mut pfs = PersistentFactStorage::new(MemoryBackend::new(), 32).unwrap(); + let facts = values + .iter() + .enumerate() + .map(|(i, v)| { + ( + uuid::Uuid::from_u128(i as u128 + 1), + ":score".into(), + v.clone(), + ) + }) + .collect(); + pfs.storage().transact(facts, None).unwrap(); + pfs.mark_dirty(); + pfs.save().unwrap(); + assert_eq!( + pfs.storage().snapshot().unwrap().pending_len(), + 0, + "committed fixture" + ); + let DatalogCommand::Query(q) = + parse_datalog_command("(query [:find ?v :where [?e :score ?v] :order-by [?v]])") + .unwrap() + else { + panic!("query"); + }; + let mut stream = crate::query::engine::open( + pfs.storage().snapshot().unwrap(), + crate::query::engine::plan(&q).unwrap(), + std::sync::Arc::new(FunctionRegistry::with_builtins()), + usize::MAX, + ) + .unwrap(); + assert!( + stream.counters().iter().all(|c| c.op != "Sort"), + "the portable path is optimized" + ); + let mut actual = Vec::new(); + while let Some(batch) = stream.next_rows().unwrap() { + actual.extend(batch); + } + let mut expected = values + .iter() + .map(|v| match v { + Value::Float(f) if f.is_nan() => Value::Float(f64::NAN), + v => v.clone(), + }) + .collect::>(); + expected.sort_by(value_order); + assert_eq!(actual.len(), expected.len()); + for (row, expected) in actual.iter().zip(&expected) { + match (row.first(), expected) { + (Some(Value::Float(a)), Value::Float(b)) => assert_eq!(a.to_bits(), b.to_bits()), + (Some(a), b) => assert!(a == b, "identical scalar value"), + _ => panic!("one scalar column"), + } + } + } +} diff --git a/src/query/engine/order_tests.rs b/src/query/engine/order_tests.rs new file mode 100644 index 0000000000..0c65135bb2 --- /dev/null +++ b/src/query/engine/order_tests.rs @@ -0,0 +1,856 @@ +//! Ordered input optimizations compared with the original materialized path. + +use super::{BATCH_ROWS, Counters}; +use crate::{Minigraf, Value}; + +fn fixture(n: usize) -> (tempfile::TempDir, Minigraf) { + let dir = tempfile::tempdir().unwrap(); + let db = Minigraf::open(dir.path().join("ordered.graph")).unwrap(); + let facts: String = (0..n) + .map(|i| format!("[:e{i} :score {}]", (i * 337) % n)) + .collect(); + db.execute(&format!("(transact [{facts}])")).unwrap(); + db.checkpoint().unwrap(); + (dir, db) +} + +fn collect(db: &Minigraf, query: &str) -> (Vec>, Vec) { + let mut cursor = db.query(&format!("(query {query})")).unwrap(); + // Cursor discards its stream at EOF; retain the stream itself so its + // closed-operator counters can still establish how much input was read. + let stream = cursor.stream_mut().unwrap(); + let mut rows = Vec::new(); + while let Some(batch) = stream.next_rows().unwrap() { + rows.extend(batch); + } + (rows, stream.counters()) +} + +#[test] +fn scalar_order_omits_sort_and_restores_projection_slots() { + let (_dir, db) = fixture(4096); + let (rows, counters) = collect( + &db, + "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 10]", + ); + let expected: Vec<_> = (0..10).map(|n| vec![Value::Integer(n)]).collect(); + assert!(rows == expected, "the original value slot is projected"); + assert!( + counters.iter().all(|c| c.op != "Sort"), + "a proved complete order omits Sort" + ); +} + +#[test] +fn ordered_scan_limit_offset_reads_only_a_prefix() { + let (_dir, db) = fixture(4096); + let (rows, counters) = collect( + &db, + "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 10 :offset 7]", + ); + let expected: Vec<_> = (7..17).map(|n| vec![Value::Integer(n)]).collect(); + assert!(rows == expected, "offset applies in semantic value order"); + let scan = counters.iter().find(|c| c.op == "Scan").unwrap(); + assert!( + scan.rows_in <= (17 + BATCH_ROWS) as u64, + "ordered Limit stops before reading all input" + ); +} + +#[test] +fn uuid_tie_suffix_and_descending_order_keep_sort() { + let (_dir, db) = fixture(32); + for query in [ + "[:find ?e ?v :where [?e :score ?v] :order-by [?v] :limit 10]", + "[:find ?v :where [?e :score ?v] :order-by [?v :desc] :limit 10]", + ] { + let (_, counters) = collect(&db, query); + assert!(counters.iter().any(|c| c.op == "Sort"), "Sort is retained"); + } +} + +fn has_sort(counters: &[Counters]) -> bool { + counters.iter().any(|c| c.op == "Sort") +} + +fn same_rows(a: &[Vec], b: &[Vec]) -> bool { + a.len() == b.len() + && a.iter().zip(b).all(|(a, b)| { + a.len() == b.len() + && a.iter().zip(b).all(|(a, b)| match (a, b) { + (Value::Float(a), Value::Float(b)) => a.to_bits() == b.to_bits(), + _ => a == b, + }) + }) +} + +#[test] +fn forced_fallback_restores_sort_and_gives_the_same_ordered_list() { + let (_dir, db) = fixture(128); + let q = "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 10 :offset 7]"; + let (expected, fallback) = { + let _off = super::order::set_enabled(false); + collect(&db, q) + }; + let (actual, optimized) = collect(&db, q); + assert!(has_sort(&fallback), "the switch forces the original Sort"); + assert!( + !has_sort(&optimized), + "dropping the guard restores optimization" + ); + assert!(same_rows(&actual, &expected), "identical ordered rows"); +} + +#[test] +fn distinct_preserves_integer_order_but_float_canonicalization_keeps_sort() { + let (_dir, db) = fixture(16); + let q = "[:find ?v :where [?e :score ?v] :distinct :order-by [?v] :limit 3]"; + assert!( + !has_sort(&collect(&db, q).1), + "integer distinct keeps an ordered subsequence" + ); + db.execute("(transact [[:a :f -0.0] [:b :f 0.0] [:c :f 1.0]])") + .unwrap(); + db.checkpoint().unwrap(); + let q = "[:find ?v :where [?e :f ?v] :distinct :order-by [?v]]"; + let (actual, counters) = collect(&db, q); + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, q) + }; + assert!( + has_sort(&counters), + "canonicalization invalidates the float certificate" + ); + assert!( + same_rows(&actual, &expected), + "canonical float bits are unchanged" + ); +} + +#[test] +fn an_open_ordered_cursor_keeps_its_reader_across_checkpoint_and_reuse() { + let (_dir, db) = fixture(32); + let mut cursor = db + .query("(query [:find ?v :where [?e :score ?v] :order-by [?v] :limit 10])") + .unwrap(); + assert!( + !has_sort(&cursor.counters()), + "the original snapshot was certified" + ); + for i in 1..=4 { + db.execute(&format!("(transact [[:new{i} :score -{i}]])")) + .unwrap(); + db.checkpoint().unwrap(); + } + let mut rows = Vec::new(); + while let Some(batch) = cursor.next_batch(3).unwrap() { + rows.extend(batch); + } + let expected: Vec<_> = (0..10).map(|n| vec![Value::Integer(n)]).collect(); + assert!( + same_rows(&rows, &expected), + "no rows from later generations leak in" + ); + let (new, _) = collect( + &db, + "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 1]", + ); + assert!( + new == vec![vec![Value::Integer(-4)]], + "new opens see the new generation" + ); +} + +#[test] +fn prepared_queries_recheck_each_snapshot_and_rules_keep_original_strategy() { + let (_dir, db) = fixture(32); + let prepared = db + .prepare("(query [:find ?v :where [?e :score ?v] :order-by [?v] :limit $n])") + .unwrap(); + let bindings = [("n", crate::BindValue::Val(Value::Integer(1)))]; + let before = prepared.query(&bindings).unwrap(); + assert!( + !has_sort(&before.counters()), + "prepared execution is eligible" + ); + drop(before); + db.execute("(transact [[:new :score -1]])").unwrap(); + let mut pending = prepared.query(&bindings).unwrap(); + assert!(has_sort(&pending.counters()), "no stale prepared proof"); + assert!(pending.next_batch(1).unwrap().unwrap().rows() == [vec![Value::Integer(-1)]]); + drop(pending); + db.checkpoint().unwrap(); + assert!( + !has_sort(&prepared.query(&bindings).unwrap().counters()), + "checkpoint re-enables proof" + ); + db.execute("(rule [(scored ?e ?v) [?e :score ?v]])") + .unwrap(); + let (_, counters) = collect( + &db, + "[:find ?v :where (scored ?e ?v) :order-by [?v] :limit 3]", + ); + assert!(has_sort(&counters), "rule construction is unchanged"); +} + +#[test] +fn snapshot_pending_existence_uses_the_captured_prefix_and_staged_view() { + use crate::graph::storage::FactStorage; + use crate::graph::types::Fact; + let storage = FactStorage::new(); + let e = uuid::Uuid::from_u128(2); + let other = uuid::Uuid::from_u128(1); + let empty = storage.snapshot().unwrap(); + storage + .transact(vec![(e, ":a".into(), Value::Integer(1))], None) + .unwrap(); + assert!( + !empty.has_pending(":a", None).unwrap(), + "an old empty view stays empty" + ); + let snapshot = storage.snapshot().unwrap(); + storage + .transact( + vec![ + (other, ":new".into(), Value::Integer(2)), + (other, ":a".into(), Value::Integer(3)), + ], + None, + ) + .unwrap(); + assert!(snapshot.has_pending(":a", None).unwrap()); + assert!(snapshot.has_pending(":a", Some(&e)).unwrap()); + assert!(snapshot.has_pending(":a", None).unwrap()); + assert!(snapshot.has_pending(":a", Some(&e)).unwrap()); + assert!(!snapshot.has_pending(":a", Some(&other)).unwrap()); + assert!(!snapshot.has_pending(":new", None).unwrap()); + assert!(!snapshot.has_pending(":new", Some(&e)).unwrap()); + let mut retract = + Fact::with_valid_time(other, ":new".into(), Value::Integer(2), 20, 2, 0, i64::MAX); + retract.asserted = false; + let staged = snapshot.with_staged(vec![retract]); + assert!( + staged.has_pending(":new", None).unwrap(), + "staged retractions also disqualify" + ); + assert!(staged.has_pending(":new", Some(&other)).unwrap()); +} + +#[test] +fn unrelated_pending_facts_do_not_disable_order_but_in_range_records_do() { + let (_dir, db) = fixture(32); + let q = "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 3]"; + db.execute("(transact [[:unrelated :name \"pending\"]])") + .unwrap(); + assert!(!has_sort(&collect(&db, q).1), "unrelated pending range"); + db.execute("(transact [[:new :score -1]])").unwrap(); + let (rows, counters) = collect(&db, q); + assert!(has_sort(&counters), "a second input run needs Sort"); + assert!( + rows == vec![ + vec![Value::Integer(-1)], + vec![Value::Integer(0)], + vec![Value::Integer(1)] + ] + ); + db.checkpoint().unwrap(); + assert!( + !has_sort(&collect(&db, q).1), + "each open proves its own snapshot" + ); + db.execute("(retract [[:new :score -1]])").unwrap(); + assert!( + has_sort(&collect(&db, q).1), + "pending retractions also disqualify" + ); +} + +#[test] +fn committed_history_of_another_kind_disqualifies_the_entire_range() { + let (_dir, db) = fixture(32); + db.execute("(transact [[:history :score \"old\"]])") + .unwrap(); + db.execute("(retract [[:history :score \"old\"]])").unwrap(); + db.checkpoint().unwrap(); + let (_, counters) = collect( + &db, + "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 3]", + ); + assert!( + has_sort(&counters), + "dead historical keys still prevent a kind proof" + ); +} + +#[test] +fn bool_float_and_single_entity_value_ranges_match_the_original_sort() { + let (_dir, db) = fixture(16); + db.execute( + "(transact [[:a :f -0.0] [:b :f 0.0] [:c :f -1.5] [:d :f 2.0] \ + [:a :b true] [:b :b false] [:one :s 8] [:one :s -2] [:one :s 3]])", + ) + .unwrap(); + db.checkpoint().unwrap(); + for q in [ + "[:find ?v :where [?e :f ?v] :order-by [?v]]", + "[:find ?v :where [?e :b ?v] :order-by [?v]]", + "[:find ?v :where [:one :s ?v] :order-by [?v]]", + ] { + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, q) + }; + let (actual, counters) = collect(&db, q); + assert!(!has_sort(&counters), "supported scalar range"); + assert!(same_rows(&actual, &expected), "same values and float bits"); + } +} + +#[test] +fn mixed_numeric_kinds_strings_keywords_refs_sets_and_nil_keep_sort() { + let (_dir, db) = fixture(8); + db.execute( + "(transact [[:a :mixed 2] [:b :mixed 1.5] [:a :str \"b\"] [:b :str \"a\"] \ + [:a :kw :z] [:b :kw :a] [:a :ref #uuid \"00000000-0000-0000-0000-000000000002\"] \ + [:b :ref #uuid \"00000000-0000-0000-0000-000000000001\"] \ + [:a :set #{1 2}] [:b :set #{1}] [:a :nil nil]])", + ) + .unwrap(); + db.checkpoint().unwrap(); + for a in ["mixed", "str", "kw", "ref", "set", "nil"] { + let q = format!("[:find ?v :where [?e :{a} ?v] :order-by [?v]]"); + let (actual, counters) = collect(&db, &q); + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, &q) + }; + assert!(has_sort(&counters), "uncertified value kind"); + assert!( + same_rows(&actual, &expected), + "fallback preserves full order" + ); + } +} + +#[test] +fn constant_and_repeated_projection_columns_preserve_the_complete_order() { + let (_dir, db) = fixture(32); + for q in [ + "[:find ?v ?v :where [?e :score ?v] :order-by [?v] :limit 3]", + "[:find ?c ?v :where [?e :score ?v] [(+ 20 22) ?c] :order-by [?v] :limit 3]", + "[:find ?c ?v :where [?e :score ?v] [(+ 20 22) ?c] :order-by [?c :desc ?v] :limit 3]", + ] { + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, q) + }; + let (actual, counters) = collect(&db, q); + assert!( + !has_sort(&counters), + "constants/repetitions add no tie requirement" + ); + assert!( + same_rows(&actual, &expected), + "nonidentity projection is restored" + ); + } +} + +#[test] +fn nested_and_binding_callbacks_keep_sort_and_late_errors_under_limit() { + use std::sync::{ + Arc, + atomic::{AtomicUsize, Ordering}, + }; + let (_dir, db) = fixture(4096); + let calls = Arc::new(AtomicUsize::new(0)); + let seen = calls.clone(); + db.try_register_predicate("boom?", move |_| { + if seen.fetch_add(1, Ordering::SeqCst) == 1499 { + Err(crate::UdfError::new("late failure")) + } else { + Ok(true) + } + }) + .unwrap(); + for body in [ + "[(boom? ?v)]", + "[(= (boom? ?v) true)]", + "[(boom? ?v) ?ok]", + "(not [(= (boom? ?v) false)])", + ] { + calls.store(0, Ordering::SeqCst); + let q = format!("(query [:find ?v :where [?e :score ?v] {body} :order-by [?v] :limit 10])"); + let err = db + .execute(&q) + .expect_err("Sort must reach the late callback error"); + assert_eq!(err.code(), "QRY-014"); + assert_eq!( + calls.load(Ordering::SeqCst), + 1500, + "no call after the failure" + ); + } +} + +#[test] +fn collect_set_data_errors_are_not_hidden_by_ordered_limit() { + let (_dir, db) = fixture(4096); + let bad = (0..4096).find(|i| i * 337 % 4096 == 4095).unwrap(); + db.execute(&format!("(transact [[:e{bad} :items #{{1}}]])")) + .unwrap(); + db.checkpoint().unwrap(); + let err = db + .execute( + "(query [:find ?v :where [?e :score ?v] \ + [(collect-set ?e :items) ?s] :order-by [?v] :limit 10])", + ) + .expect_err("a late nested set remains an error"); + assert_eq!(err.code(), "QRY-015"); +} + +#[test] +fn staged_negative_values_and_working_reader_type_changes_keep_correct_order() { + let dir = tempfile::tempdir().unwrap(); + let db = crate::OpenOptions::new() + .transaction_chunk_facts(2) + .path(dir.path().join("large.graph")) + .open() + .unwrap(); + db.execute("(transact [[:a :score 0] [:b :score 2]])") + .unwrap(); + db.checkpoint().unwrap(); + let q = "(query [:find ?v :where [?e :score ?v] :order-by [?v] :limit 1])"; + { + let mut tx = db.begin_write().unwrap(); + tx.execute("(transact [[:staged :score -1]])").unwrap(); + let crate::QueryResult::QueryResults { results, .. } = tx.execute(q).unwrap() else { + panic!("rows"); + }; + assert!( + results == vec![vec![Value::Integer(-1)]], + "staged run is sorted with committed rows" + ); + } + { + let mut tx = db.begin_write().unwrap(); + tx.execute("(transact [[:new :score -0.5] [:x :other 1] [:y :other 2]])") + .unwrap(); + let crate::QueryResult::QueryResults { results, .. } = tx.execute(q).unwrap() else { + panic!("rows"); + }; + assert!( + results == vec![vec![Value::Float(-0.5)]], + "kind proof reads working roots, not published roots" + ); + } + assert!( + !has_sort(&collect(&db, "[:find ?v :where [?e :score ?v] :order-by [?v]]").1), + "rollback does not leave a stale type proof" + ); +} + +#[test] +fn temporal_queries_match_fallback_with_duplicate_values_and_metadata() { + let (_dir, db) = fixture(32); + db.execute( + "(transact {:valid-from \"2020-01-01\" :valid-to \"2021-01-01\"} \ + [[:hist1 :score -2]])", + ) + .unwrap(); + db.execute("(transact {:valid-from \"2022-01-01\"} [[:hist2 :score -2]])") + .unwrap(); + db.checkpoint().unwrap(); + for temporal in [ + ":as-of 1 :valid-at :any-valid-time", + ":as-of 2 :valid-at :any-valid-time", + ":valid-at \"2020-06-01\"", + ":valid-at \"2022-06-01\"", + ":valid-at :any-valid-time", + ] { + let q = format!("[:find ?v {temporal} :where [?e :score ?v] :order-by [?v] :limit 10]"); + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, &q) + }; + let (actual, counters) = collect(&db, &q); + assert!( + !has_sort(&counters), + "time filtering preserves raw key order" + ); + assert!( + same_rows(&actual, &expected), + "same temporal rows and multiplicities" + ); + } + for q in [ + "[:find ?v ?f :valid-at :any-valid-time :where [?e :score ?v] [?e :db/valid-from ?f] :order-by [?v ?f]]", + "[:find ?t ?v :valid-at :any-valid-time :where [?e :score ?v] [?e :db/valid-at ?t] :order-by [?t ?v]]", + ] { + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, q) + }; + let (actual, _) = collect(&db, q); + assert!( + same_rows(&actual, &expected), + "metadata columns and nil valid-at are preserved" + ); + } +} + +#[test] +fn successful_working_tree_proofs_are_fresh_after_each_statement_and_rollback() { + fn values(result: crate::QueryResult) -> Vec> { + let crate::QueryResult::QueryResults { results, .. } = result else { + panic!("rows"); + }; + results + } + let proofs = || super::order::OPTIMIZATIONS.with(std::cell::Cell::get); + let dir = tempfile::tempdir().unwrap(); + let db = crate::OpenOptions::new() + .transaction_chunk_facts(2) + .path(dir.path().join("working.graph")) + .open() + .unwrap(); + db.execute("(transact [[:a :score 0] [:b :score 2]])") + .unwrap(); + db.checkpoint().unwrap(); + let q = "(query [:find ?v :where [?e :score ?v] :order-by [?v] :limit 1])"; + let mut tx = db.begin_write().unwrap(); + tx.execute("(transact [[:new :score -1] [:x :other 1] [:y :other 2]])") + .unwrap(); + let before = proofs(); + assert!(values(tx.execute(q).unwrap()) == vec![vec![Value::Integer(-1)]]); + assert_eq!(proofs(), before + 1, "working-tree input really omits Sort"); + tx.execute("(transact [[:newer :score -2]])").unwrap(); + assert!(values(tx.execute(q).unwrap()) == vec![vec![Value::Integer(-2)]]); + assert_eq!( + proofs(), + before + 2, + "a new query reads the new working roots" + ); + let err = tx + .execute( + "(transact [[:bad :score \"rolled back\"] \ + [:dup :other 1 {:valid-from \"2020-01-01\"}] [:filler :other 2] \ + [:dup :other 1 {:valid-from \"2021-01-01\"}]])", + ) + .expect_err("one triple, two windows"); + assert_eq!(err.code(), "API-011"); + assert!(values(tx.execute(q).unwrap()) == vec![vec![Value::Integer(-2)]]); + assert_eq!( + proofs(), + before + 3, + "rejected statement restores the proof's actual reader" + ); + tx.execute("(transact [[:mixed :score -3.5]])").unwrap(); + assert!(values(tx.execute(q).unwrap()) == vec![vec![Value::Float(-3.5)]]); + assert_eq!( + proofs(), + before + 3, + "a changed type invalidates subsequent proofs" + ); + drop(tx); + assert!(values(db.execute(q).unwrap()) == vec![vec![Value::Integer(0)]]); + assert_eq!( + proofs(), + before + 4, + "rollback leaves the published integer generation eligible" + ); +} + +#[test] +fn filters_entity_probes_and_anti_joins_preserve_unchanged_order_columns() { + let (_dir, db) = fixture(32); + let facts: String = (0..32) + .map(|i| format!("[:e{i} :flag true] [:m{i} :match {i}]")) + .collect(); + db.execute(&format!("(transact [{facts}])")).unwrap(); + db.checkpoint().unwrap(); + let _text_order = crate::query::datalog::optimizer::set_reorder(false); + for body in [ + "[(>= ?v 7)]", + "[?e :flag true]", + "[?other :match ?v]", + "(not [?e :missing true])", + ] { + let q = format!("[:find ?v :where [?e :score ?v] {body} :order-by [?v] :limit 10]"); + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, &q) + }; + let (actual, counters) = collect(&db, &q); + assert!( + !has_sort(&counters), + "a preserving operator keeps the outer order" + ); + assert!( + same_rows(&actual, &expected), + "same complete ordered result" + ); + } +} + +#[test] +fn expression_priority_replacement_invalidates_the_ordered_slot() { + let (_dir, db) = fixture(32); + let _on = crate::query::datalog::optimizer::set_reorder(true); + // The selective score pattern runs first. The earlier expression then + // replaces its ?v after the broad entity probe binds ?x. + let q = "[:find ?v :where [?e ?a ?x] [(+ ?x 0) ?v] [?e :score ?v] :order-by [?v] :limit 3]"; + assert!( + query_plan(q).steps.iter().any(|s| matches!( + s, + super::plan::Step::Bind(_, _, _, super::plan::Out::Replace) + )), + "replacement path" + ); + let (actual, counters) = collect(&db, q); + let (expected, _) = { + let _off = super::order::set_enabled(false); + collect(&db, q) + }; + assert!( + has_sort(&counters), + "replacement is not certified as order-preserving" + ); + assert!(same_rows(&actual, &expected)); +} + +#[test] +fn value_probe_runtime_fallback_preserves_order_only_when_it_streams_the_outer() { + use super::plan::{JoinKind, Step}; + use crate::query::datalog::{ + functions::FunctionRegistry, parser::parse_datalog_command, types::DatalogCommand, + }; + let (_dir, db) = fixture(32); + let named = uuid::Uuid::new_v5(&uuid::Uuid::NAMESPACE_OID, b":named"); + let mut facts = String::new(); + for i in 0..32 { + if i < 16 { + facts.push_str(&format!("[:e{i} :friend {i}] [:m{i} :alias {i}]")); + } else { + facts.push_str(&format!("[:e{i} :friend #uuid \"{named}\"]")); + } + } + facts.push_str("[:named-alias :alias :named]"); + db.execute(&format!("(transact [{facts}])")).unwrap(); + db.checkpoint().unwrap(); + let _text_order = crate::query::datalog::optimizer::set_reorder(false); + let DatalogCommand::Query(q) = parse_datalog_command( + "(query [:find ?v :where [?e :score ?v] [?e :friend ?target] \ + [?other :alias ?target] :order-by [?v]])", + ) + .unwrap() else { + panic!("query"); + }; + for build_inner in [true, false] { + let mut plan = super::plan(&q).unwrap(); + let join = plan + .steps + .iter_mut() + .rev() + .find_map(|s| match s { + Step::Join(j) if matches!(j.kind, JoinKind::ProbeValue { .. }) => Some(j), + _ => None, + }) + .expect("value probe"); + join.kind = JoinKind::ProbeValue { + key: match join.kind { + JoinKind::ProbeValue { key, .. } => key, + _ => panic!("probe"), + }, + build_inner, + }; + let mut stream = super::open( + db.snapshot().unwrap(), + plan, + std::sync::Arc::new(FunctionRegistry::with_builtins()), + usize::MAX, + ) + .unwrap(); + assert_eq!( + has_sort(&stream.counters()), + !build_inner, + "fallback orientation controls the proof" + ); + let mut rows = Vec::new(); + while let Some(batch) = stream.next_rows().unwrap() { + rows.extend(batch); + } + let expected: Vec<_> = (0..32).map(|v| vec![Value::Integer(v)]).collect(); + assert!( + same_rows(&rows, &expected), + "ambiguous ref/keyword probes still give the full ordered result" + ); + } +} + +/// Real reader with instrumentation only around optional proof reads. +struct ProofKeys<'a> { + base: &'a dyn crate::storage::KeySource, + calls: std::sync::atomic::AtomicUsize, + fail_at: Option, +} + +macro_rules! forward_keys { + ($($name:ident($($arg:ident: $ty:ty),*) -> $ret:ty;)*) => { + $(fn $name(&self, $($arg: $ty),*) -> $ret { self.base.$name($($arg),*) })* + }; +} + +impl crate::storage::KeySource for ProofKeys<'_> { + fn any_key(&self, index: crate::storage::keys::Index, prefix: &[u8]) -> anyhow::Result { + let call = self.calls.fetch_add(1, std::sync::atomic::Ordering::SeqCst) + 1; + if self.fail_at == Some(call) { + anyhow::bail!("optional proof read failed"); + } + self.base.any_key(index, prefix) + } + + forward_keys! { + next_ids() -> (u64, u32); + eid_of(e: &uuid::Uuid) -> anyhow::Result>; + iid_of(a: &str) -> anyhow::Result>; + uuid_of(e: u64) -> anyhow::Result; + uuids_of(e: &[u64], visit: &mut dyn FnMut(u64, uuid::Uuid) -> anyhow::Result<()>) -> anyhow::Result<()>; + ident_of(i: u32) -> anyhow::Result; + long_value(r: crate::storage::keys::ValueRef) -> anyhow::Result; + long_value_ref(s: &str) -> anyhow::Result>; + long_bytes(r: crate::storage::keys::ValueRef) -> anyhow::Result>; + long_bytes_ref(s: &[u8]) -> anyhow::Result>; + tx_id_of(n: u64) -> anyhow::Result; + tx_order() -> anyhow::Result; + last_tx_at(t: u64) -> anyhow::Result; + tx_runs(t: u64, out: &mut Vec<(u64, u64)>) -> anyhow::Result<()>; + live_keys(index: crate::storage::keys::Index, prefix: &[u8], resume: Option<&[u8]>, + bound: &crate::storage::TxBound, max: usize, out: &mut Vec) + -> anyhow::Result>>; + } +} + +fn query_plan(query: &str) -> super::Plan { + use crate::query::datalog::{parser::parse_datalog_command, types::DatalogCommand}; + let DatalogCommand::Query(q) = parse_datalog_command(&format!("(query {query})")).unwrap() + else { + panic!("query"); + }; + super::plan(&q).unwrap() +} + +#[test] +fn optional_proofs_are_bounded_and_queries_without_a_usable_demand_do_no_probes() { + use crate::query::datalog::functions::FunctionRegistry; + let (_dir, db) = fixture(32); + let snapshot = db.snapshot().unwrap(); + let base = snapshot.committed.as_ref().unwrap().key_source().unwrap(); + for (q, expected) in [ + ( + "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 3]", + 8, + ), + ("[:find ?v :where [?e :score ?v] :limit 3]", 0), + ( + "[:find ?v :where [?e :score ?v] :order-by [?v :desc] :limit 3]", + 0, + ), + ( + "[:find ?v :where [?e :score ?v] :order-by [?v] :limit 0]", + 0, + ), + ( + "[:find ?v :where [?e :score ?v] :order-by [?v] :offset 7 :limit 0]", + 0, + ), + ( + "[:find ?e ?v :where [?e :score ?v] :order-by [?v] :limit 3]", + 0, + ), + ( + "[:find ?v :where [?e :missing ?v] :order-by [?v] :limit 3]", + 0, + ), + ( + "[:find ?e :where [?e :score ?e] :order-by [?e] :limit 3]", + 0, + ), + ] { + let keys = ProofKeys { + base, + calls: 0.into(), + fail_at: None, + }; + let mut plan = query_plan(q); + super::order::resolve( + &snapshot, + Some(&keys), + &FunctionRegistry::with_builtins(), + &mut plan, + ); + assert_eq!( + keys.calls.load(std::sync::atomic::Ordering::SeqCst), + expected, + "bounded optional proof reads" + ); + } +} + +#[test] +fn every_failed_optional_read_retains_the_original_sort_projection_and_index() { + use super::plan::{Source, Step}; + use crate::query::datalog::functions::FunctionRegistry; + let (_dir, db) = fixture(32); + let snapshot = db.snapshot().unwrap(); + let base = snapshot.committed.as_ref().unwrap().key_source().unwrap(); + for fail_at in 1..=8 { + let keys = ProofKeys { + base, + calls: 0.into(), + fail_at: Some(fail_at), + }; + let mut plan = query_plan("[:find ?v :where [?e :score ?v] :order-by [?v] :limit 3]"); + let original_find = plan.find.clone(); + super::order::resolve( + &snapshot, + Some(&keys), + &FunctionRegistry::with_builtins(), + &mut plan, + ); + assert!( + plan.steps.iter().any(|s| matches!(s, Step::Sort { .. })), + "Sort remains" + ); + assert_eq!( + plan.find, original_find, + "projection is not partially restored" + ); + assert!( + matches!(&plan.source, Source::Scan(s) if s.index.is_none()), + "index choice is unchanged" + ); + let _off = super::order::set_enabled(false); + let mut fallback = super::open( + snapshot.clone(), + plan, + std::sync::Arc::new(FunctionRegistry::with_builtins()), + usize::MAX, + ) + .unwrap(); + assert!(has_sort(&fallback.counters())); + let mut rows = Vec::new(); + while let Some(batch) = fallback.next_rows().unwrap() { + rows.extend(batch); + } + assert!( + rows == vec![ + vec![Value::Integer(0)], + vec![Value::Integer(1)], + vec![Value::Integer(2)] + ], + "a failed optional proof still executes the original query" + ); + } +} diff --git a/src/query/engine/plan.rs b/src/query/engine/plan.rs index 494cc98e35..207c6fd05d 100644 --- a/src/query/engine/plan.rs +++ b/src/query/engine/plan.rs @@ -115,6 +115,8 @@ pub(crate) enum Meta { /// What a `Scan` reads. #[derive(Debug, Clone)] pub(crate) struct ScanSpec { + /// Snapshot-resolved source index (#641); otherwise normal index choice. + pub(crate) index: Option, pub(crate) e: Term, pub(crate) a: Term, pub(crate) v: Term, @@ -1068,6 +1070,7 @@ impl Builder { metas.push((m, slot)); } self.source = Some(Source::Scan(ScanSpec { + index: None, e, a, v, @@ -1165,6 +1168,7 @@ impl Builder { Some((entity, attribute)) => Step::CollectSet(CollectSpec { entity, inner: ScanSpec { + index: None, e: Term::Bind(0), a: Term::Const(attribute.clone()), v: Term::Bind(1), @@ -1502,6 +1506,7 @@ fn join( } Ok(JoinSpec { inner: ScanSpec { + index: None, e, a, v, diff --git a/src/query/engine/project.rs b/src/query/engine/project.rs index 3106d11855..3bfd69ce4d 100644 --- a/src/query/engine/project.rs +++ b/src/query/engine/project.rs @@ -177,6 +177,9 @@ mod tests { // The unused storage operations cannot affect a projection-only test. impl KeySource for Keys { + fn any_key(&self, _: Index, _: &[u8]) -> Result { + panic!("unused") + } fn next_ids(&self) -> (u64, u32) { (self.limit, 1) } diff --git a/src/query/engine/recursive.rs b/src/query/engine/recursive.rs index f842fe9732..43ad81a572 100644 --- a/src/query/engine/recursive.rs +++ b/src/query/engine/recursive.rs @@ -112,6 +112,7 @@ fn know_stored( return Ok(()); }; let mut scan = Scan::new(ScanSpec { + index: None, e: Term::Bind(0), a: Term::Const(attr.clone()), v: Term::Bind(1), diff --git a/src/query/engine/scan.rs b/src/query/engine/scan.rs index c4dadd9443..f8093f261f 100644 --- a/src/query/engine/scan.rs +++ b/src/query/engine/scan.rs @@ -752,7 +752,10 @@ fn open( (Some(e), Some(a), t) => (vec![(Index::Eavt, keys::entity_attribute_prefix(e, a))], t), (Some(e), None, t) => (vec![(Index::Eavt, keys::entity_prefix(e))], t), (None, Some(a), Some(t)) => avet(a, t), - (None, Some(a), None) => (vec![(Index::Aevt, keys::attribute_prefix(a))], None), + (None, Some(a), None) => ( + vec![(spec.index.unwrap_or(Index::Aevt), keys::attribute_prefix(a))], + None, + ), (None, None, t) => (vec![(Index::Eavt, Vec::new())], t), }; let mut shadow = HashSet::new(); diff --git a/src/query/engine/sort.rs b/src/query/engine/sort.rs index 7c663147ac..e4f0f57939 100644 --- a/src/query/engine/sort.rs +++ b/src/query/engine/sort.rs @@ -5,8 +5,9 @@ //! compares, and turns them back into cells only for the rows it returns. //! Under a `:limit` (`keep = k`) it holds at most `k` rows, in a binary heap //! whose top is the worst row held, so its memory follows `k`, not the -//! answer. Either way it reads its whole input; skipping that when an index -//! returns the rows in order is #641. +//! answer. Either way it reads its whole input. The snapshot-bound order +//! resolver omits this operator when a committed scalar range proves the full +//! result order (#641). use super::batch::Batch; use super::cell::{Cell, Scalar}; diff --git a/src/storage/keys.rs b/src/storage/keys.rs index 483adbe076..c0e83639c5 100644 --- a/src/storage/keys.rs +++ b/src/storage/keys.rs @@ -787,21 +787,45 @@ pub fn attribute_value_prefix(a: u32, v: &KeyValue) -> Vec { k } -/// A kind of value whose matches a constant cannot name by one key: a float -/// matches `0.0` and `-0.0` alike (#706), keywords match a UUID constant by -/// the entity they name (#544). +/// A key value's kind. Constants read floats and keywords by kind (#706, +/// #544); order proofs check every kind, including historical keys (#641). #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ValueKind { + Null, + Boolean, + Integer, Float, + String, Keyword, + Ref, + Set, +} + +impl ValueKind { + pub const ALL: [Self; 8] = [ + Self::Null, + Self::Boolean, + Self::Integer, + Self::Float, + Self::String, + Self::Keyword, + Self::Ref, + Self::Set, + ]; } /// Key prefix of every AVET entry of attribute `a` with a value of `kind`. pub fn attribute_kind_prefix(a: u32, kind: ValueKind) -> Vec { let mut k = attribute_prefix(a); k.push(match kind { + ValueKind::Null => TAG_NULL, + ValueKind::Boolean => TAG_BOOL, + ValueKind::Integer => TAG_INT, ValueKind::Float => TAG_FLOAT, + ValueKind::String => TAG_STRING, ValueKind::Keyword => TAG_KEYWORD, + ValueKind::Ref => TAG_REF, + ValueKind::Set => TAG_SET, }); k } @@ -1497,4 +1521,61 @@ mod tests { assert_eq!(MAX_VALUE_BYTES, 4068); assert_eq!(MAX_IDENT_BYTES, 1024); } + + #[test] + fn kind_prefixes_cover_every_encoded_value_variant_exactly_once() { + fn kind(v: &KeyValue) -> ValueKind { + // Intentionally exhaustive: new variants must update this proof. + match v { + KeyValue::Null => ValueKind::Null, + KeyValue::Bool(_) => ValueKind::Boolean, + KeyValue::Int(_) => ValueKind::Integer, + KeyValue::Float(_) => ValueKind::Float, + KeyValue::Str(_) | KeyValue::LongStr { .. } => ValueKind::String, + KeyValue::Keyword(_) => ValueKind::Keyword, + KeyValue::Ref(_) => ValueKind::Ref, + KeyValue::Set(_) | KeyValue::LongSet { .. } => ValueKind::Set, + } + } + let r = ValueRef { page: 2, slot: 0 }; + let values = [ + KeyValue::Null, + KeyValue::Bool(false), + KeyValue::Int(-1), + KeyValue::Float(-0.0), + KeyValue::Str("a".into()), + long_str(&"x".repeat(65), r), + KeyValue::Keyword(3), + KeyValue::Ref(4), + KeyValue::Set(vec![]), + KeyValue::LongSet { + prefix: vec![1], + hash: 1, + vref: r, + }, + ]; + for (i, k) in ValueKind::ALL.iter().enumerate() { + assert!( + !ValueKind::ALL.iter().take(i).any(|other| other == k), + "unique kinds" + ); + assert!( + values.iter().any(|v| kind(v) == *k), + "every kind has a value witness" + ); + } + for v in &values { + let mut bytes = attribute_prefix(7); + put_value(&mut bytes, v); + let matched: Vec<_> = ValueKind::ALL + .iter() + .copied() + .filter(|k| bytes.starts_with(&attribute_kind_prefix(7, *k))) + .collect(); + assert!( + matched == [kind(v)], + "exactly one kind prefix matches the actual encoding" + ); + } + } } diff --git a/src/storage/mod.rs b/src/storage/mod.rs index 88e3cb3278..20753c1ca5 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -549,6 +549,9 @@ pub trait KeySource: Send + Sync { /// Append to `out` the transactions with `tx_id <= t` as sorted, /// disjoint, inclusive `tx_count` ranges. fn tx_runs(&self, t: u64, out: &mut Vec<(u64, u64)>) -> Result<()>; + /// Whether an index has any raw key with this prefix, including historical + /// and retracted records. One seek; no search for a live version (#641). + fn any_key(&self, index: keys::Index, prefix: &[u8]) -> Result; /// The keys of `index` that start with `prefix` and survive net-assert /// among the versions `bound` keeps, decoded, appended to `out` in key /// order. diff --git a/src/storage/persistent_facts.rs b/src/storage/persistent_facts.rs index 3207dc4244..e3987663ea 100644 --- a/src/storage/persistent_facts.rs +++ b/src/storage/persistent_facts.rs @@ -751,7 +751,7 @@ impl PersistentFactStorage { self.meta } - #[cfg(any(not(target_arch = "wasm32"), feature = "browser"))] + #[cfg(any(not(target_arch = "wasm32"), feature = "browser", test))] /// Mark storage as dirty (needs saving) pub fn mark_dirty(&mut self) { self.dirty = true; diff --git a/src/storage/reader.rs b/src/storage/reader.rs index 5abbaf9d8c..09ba6f1ab2 100644 --- a/src/storage/reader.rs +++ b/src/storage/reader.rs @@ -405,6 +405,17 @@ impl KeySource for OnDiskReader { Ok(()) } + fn any_key(&self, index: Index, prefix: &[u8]) -> Result { + let root = self.root(index); + if root == 0 { + return Ok(false); + } + let mut cursor = LeafCursor::new(root, Some(prefix), &self.backend, &self.cache)?; + Ok(cursor + .next_ref()? + .is_some_and(|(k, _)| k.starts_with(prefix))) + } + fn live_keys( &self, index: Index, @@ -588,6 +599,57 @@ pub fn all_entries_as_facts( .collect() } +#[cfg(test)] +mod order_probe_tests { + use super::*; + use crate::storage::btree::{build_btree, tests::CountingBackend}; + use crate::storage::keys::{KeyValue, ValueKind}; + use crate::storage::page::PageAllocator; + + #[test] + fn raw_kind_probe_sees_retractions_without_walking_them() { + let mut backend = CountingBackend::new(); + let cache = Arc::new(PageCache::new(0)); + let entries = (1..=8192u64) + .map(|e| { + let fact = KeyFact { + e, + a: 7, + v: KeyValue::Float(e as f64), + tx_count: 1, + vf: 0, + vt: i64::MAX, + asserted: false, + }; + (fact.key(Index::Avet).unwrap(), Vec::new()) + }) + .collect(); + let mut alloc = PageAllocator::new(Vec::new(), 2, 1); + let mut meta = MetaPage::empty(1); + meta.avet_root = build_btree(entries, &mut backend, &cache, &mut alloc).unwrap(); + let backend = Arc::new(Mutex::new(backend)); + let reader = OnDiskReader::new(backend.clone(), cache, &meta); + for (kind, expected) in [(ValueKind::Float, true), (ValueKind::Integer, false)] { + backend.lock().unwrap().reset(); + let actual = reader + .any_key(Index::Avet, &keys::attribute_kind_prefix(7, kind)) + .unwrap(); + assert_eq!(actual, expected, "raw history, not live rows"); + assert!( + backend.lock().unwrap().reads() <= 8, + "one tree descent, no history walk" + ); + } + backend.lock().unwrap().reset(); + assert!(!reader.any_key(Index::Eavt, &[]).unwrap()); + assert_eq!( + backend.lock().unwrap().reads(), + 0, + "an absent tree reads no pages" + ); + } +} + #[cfg(test)] mod uuid_batch_tests { use super::*; diff --git a/tests/distinct_test.rs b/tests/distinct_test.rs index d2ebfad590..ee72434dff 100644 --- a/tests/distinct_test.rs +++ b/tests/distinct_test.rs @@ -439,6 +439,12 @@ fn distinct_memory_limit_and_cursor_cleanup() { 1 ); let q = "(query [:find ?v :where [?e :c ?v] :distinct :order-by [?v] :limit 1])"; + assert_eq!( + rows(&db, q).len(), + 1, + "ordered input stops before the bound" + ); + let q = "(query [:find ?v :where [?e :c ?v] :distinct :order-by [?v :desc] :limit 1])"; assert_eq!( db.execute(q) .expect_err("distinct retains keys even under top-k") diff --git a/tests/input_order_test.rs b/tests/input_order_test.rs new file mode 100644 index 0000000000..7df90a413d --- /dev/null +++ b/tests/input_order_test.rs @@ -0,0 +1,97 @@ +//! Differential oracle: identical ordered lists with input-order strategies +//! enabled and disabled, across the existing plan switches and snapshots. +#![cfg(all(feature = "test-hooks", not(target_arch = "wasm32")))] + +use minigraf::{Minigraf, QueryResult, Value}; + +fn rows(db: &Minigraf, q: &str) -> Vec> { + let QueryResult::QueryResults { results, .. } = db.execute(q).unwrap() else { + panic!("query rows"); + }; + results +} + +fn same(a: &[Vec], b: &[Vec]) -> bool { + a.len() == b.len() + && a.iter().zip(b).all(|(a, b)| { + a.len() == b.len() + && a.iter().zip(b).all(|(a, b)| match (a, b) { + (Value::Float(a), Value::Float(b)) => a.to_bits() == b.to_bits(), + _ => a == b, + }) + }) +} + +#[test] +fn ordered_results_are_independent_of_order_modes_and_physical_plans() { + let dir = tempfile::tempdir().unwrap(); + let db = Minigraf::open(dir.path().join("plans.graph")).unwrap(); + let facts: String = (0..128) + .map(|i| { + format!( + "[:e{i} :score {}] [:e{i} :flag {}] [:e{i} :group {}]", + (i * 37) % 128, + i % 2 == 0, + i % 4 + ) + }) + .collect(); + db.execute(&format!("(transact [{facts}])")).unwrap(); + db.execute( + "(transact [[:a :float -0.0] [:b :float 0.0] [:c :float -1.5] \ + [:one :multi 3] [:one :multi 1] [:one :multi 2]])", + ) + .unwrap(); + db.execute("(rule [(scored ?e ?v) [?e :score ?v]])") + .unwrap(); + let queries = [ + "(query [:find ?v :where [?e :score ?v] :order-by [?v] :limit 5 :offset 2])", + "(query [:find ?b :where [?e :flag ?b] :order-by [?b] :limit 5])", + "(query [:find ?v :where [:one :multi ?v] :order-by [?v]])", + "(query [:find ?v :where [?e :score ?v] [(>= ?v 20)] :order-by [?v] :limit 5])", + "(query [:find ?v :where [?e :score ?v] [?e :flag true] :order-by [?v] :limit 5])", + "(query [:find ?v :where [?e :score ?v] (not [?e :hidden true]) :order-by [?v] :limit 5])", + "(query [:find ?v :where [?e :score ?v] (or [?e :flag true] [?e :flag false]) :order-by [?v] :limit 5])", + "(query [:find ?v :where [?e :float ?v] :distinct :order-by [?v]])", + "(query [:find ?g (count ?e) :where [?e :group ?g] :order-by [?g]])", + "(query [:find ?v (rank :over (:partition-by ?e :order-by ?v)) :where [?e :score ?v] :order-by [?v]])", + "(query [:find ?v :where (scored ?e ?v) :order-by [?v] :limit 5])", + ]; + for state in 0..4 { + match state { + 1 => db.checkpoint().unwrap(), + 2 => { + db.execute("(transact [[:unrelated :name \"pending\"]])") + .unwrap(); + } + 3 => { + db.execute("(transact [[:early :score -1]])").unwrap(); + } + _ => {} + } + for reorder in [false, true] { + let _reorder = minigraf::__reorder(reorder); + for mode in [ + minigraf::Subplans::Choose, + minigraf::Subplans::Hash, + minigraf::Subplans::Correlated, + ] { + let _mode = minigraf::__subplans(mode); + for query in queries { + let expected = { + let _off = minigraf::__input_order(false); + rows(&db, query) + }; + let actual = { + let _on = minigraf::__input_order(true); + rows(&db, query) + }; + assert!( + same(&actual, &expected), + "identical ordered lists across physical strategies" + ); + } + } + } + } +}