diff --git a/cozo-core/src/query/ra.rs b/cozo-core/src/query/ra.rs index 5056f88a..8b02fd0d 100644 --- a/cozo-core/src/query/ra.rs +++ b/cozo-core/src/query/ra.rs @@ -1507,6 +1507,9 @@ impl StoredRA { } fn join_is_prefix(right_join_indices: &[usize]) -> bool { + // We do not consider partial index match to be "prefix", e.g. [a, u => c] + // with a, c bound and u unbound is not "prefix", as it is not clear that + // using prefix scanning in this case will really save us computation. let mut indices = right_join_indices.to_vec(); indices.sort(); let l = indices.len(); diff --git a/cozo-core/src/runtime/tests.rs b/cozo-core/src/runtime/tests.rs index 1a506edd..cd247874 100644 --- a/cozo-core/src/runtime/tests.rs +++ b/cozo-core/src/runtime/tests.rs @@ -920,6 +920,19 @@ fn filtering() { ") .unwrap(); assert_eq!(0, res.rows.len()); + + let res = db.run_default(r" + { + ?[x, u, y] <- [[1, 0, 2]] + :create _rel {x, u => y} + :returning + } + { + ?[x, y] := x = 1, *_rel{x, y: 3}, y = 2 + } + ") + .unwrap(); + assert_eq!(0, res.rows.len()); } #[test]