Compare fixed-dimensional vectors
Use QBit when an application supplies fixed-dimensional numeric vectors. Each value must contain exactly the declared number of non-NULL coordinates. Coordinator DB provides distance functions for comparing those stored values with a reference array; it does not promise automatic embedding generation or a vector index.
CREATE TABLE vector_items(id INTEGER PRIMARY KEY, embedding QBit(Float32, 3));
INSERT INTO vector_items VALUES (1, '[1,2,3]'), (2, '[1,2,4]');
SELECT id,
l2_distance_transposed(embedding, array(1,2,3), 32) AS distance
FROM vector_items
ORDER BY distance, id
LIMIT 2;The 32 argument selects full Float32 precision. Lower probe precision can change the distance and therefore the ranking. Keep the reference dimension and metric consistent with how the application produced its vectors. Nonfinite coordinates are invalid, and cosine distance returns NULL for a zero-norm vector.
Filter the candidate rows with ordinary predicates when the reader task is restricted to an account or category. Measure representative candidate counts and verify ranking quality before choosing a lower precision. Do not infer approximate-nearest-neighbor indexing from the presence of a distance function.
See QBit, distance functions and query measurements.