aalekh-sarvam
7cd051d7f7
fix(memory): use sqlite-vec KNN for searchVector (190x speedup)
...
Replace full-table scan via vec_distance_cosine() + ORDER BY LIMIT with
sqlite-vec's native MATCH + k = ? KNN operator. Keep vec_distance_cosine()
in the SELECT so score = 1 - dist preserves the existing cosine [0,1]
semantics the downstream merge pipeline depends on.
Fixes #69666 .
Benchmark on 10,827 chunks, 4096-dim embeddings:
- Before (full scan): ~8490 ms/query
- After (KNN + join): ~50 ms/query
No behavioral changes: returned ids and ordering are identical to the
previous query on all tested queries. The LIMIT ? binding is replaced by
k = ? which caps sqlite-vec's candidate set to the same count.
2026-04-23 04:01:47 +01:00
..
2026-04-07 15:12:32 +01:00
2026-04-06 16:58:14 +01:00
2026-04-17 02:57:18 +01:00
2026-03-27 00:47:01 +00:00
2026-04-20 21:14:46 +01:00
2026-03-27 03:35:00 +00:00
2026-04-06 18:39:06 +01:00
2026-04-06 21:28:29 +01:00
2026-04-06 22:04:23 +01:00
2026-04-06 22:04:23 +01:00
2026-04-06 19:10:31 +01:00
2026-04-06 18:39:06 +01:00
2026-04-06 20:21:46 +01:00
2026-04-06 22:04:23 +01:00
2026-04-06 22:16:12 +01:00
2026-04-17 11:09:14 +05:30
2026-04-07 00:17:08 +01:00
2026-04-18 18:31:13 +01:00
2026-04-06 22:04:23 +01:00
2026-04-06 22:04:23 +01:00
2026-04-06 21:28:29 +01:00
2026-04-06 20:21:46 +01:00
2026-04-06 20:21:46 +01:00
2026-04-06 21:28:29 +01:00
2026-04-12 11:28:43 -07:00
2026-04-15 19:28:49 +01:00
2026-04-23 04:01:47 +01:00
2026-04-06 18:39:06 +01:00
2026-04-07 00:17:08 +01:00
2026-04-07 00:17:08 +01:00
2026-04-06 20:21:46 +01:00
2026-04-06 21:11:06 +01:00
2026-04-06 21:11:06 +01:00
2026-04-06 21:11:06 +01:00
2026-04-17 11:22:56 +05:30
2026-04-17 11:09:14 +05:30
2026-04-06 20:21:46 +01:00
2026-04-07 02:03:34 +01:00
2026-04-17 11:09:14 +05:30
2026-04-17 11:09:14 +05:30
2026-04-06 21:54:32 +01:00
2026-04-06 18:39:06 +01:00
2026-04-06 21:28:29 +01:00
2026-04-06 17:04:13 +01:00
2026-04-13 15:22:44 +08:00
2026-04-15 13:06:02 -05:00
2026-04-17 11:22:56 +05:30
2026-04-06 18:39:06 +01:00
2026-03-27 00:47:01 +00:00
2026-04-17 11:09:14 +05:30
2026-04-06 21:28:29 +01:00
2026-04-12 18:53:20 +01:00
2026-03-28 09:19:52 +05:30
2026-04-07 20:58:01 +01:00
2026-04-06 22:04:23 +01:00
2026-04-06 22:04:23 +01:00
2026-04-17 02:57:18 +01:00
2026-04-06 01:52:01 +01:00
2026-04-06 01:52:01 +01:00
2026-04-15 13:06:02 -05:00
2026-04-21 18:22:21 -04:00
2026-04-21 18:22:21 -04:00
2026-04-21 18:22:21 -04:00
2026-04-21 18:22:21 -04:00
2026-04-06 05:28:18 +01:00
2026-04-06 17:04:13 +01:00
2026-03-27 03:35:00 +00:00
2026-03-27 00:47:01 +00:00