CREATE TABLE t (val vector(3));
INSERT INTO t (val) SELECT ARRAY[random(), random(), random()]::real[] FROM generate_series(1, 1000);
CREATE INDEX ON t USING vectors (val l2_ops)
WITH (options = $$
capacity = 2000
[algorithm.hnsw]
$$);
EXPLAIN SELECT 1 FROM t ORDER BY val <-> '[0.5,0.5,0.5]' limit 10;
QUERY PLAN
-----------------------------------------------------------------------------
Limit (cost=0.00..0.22 rows=10 width=8)
-> Index Scan using t_val_idx on t (cost=0.00..22.51 rows=1000 width=8)
Order By: (val <-> '[0.5, 0.5, 0.5]'::vector)
EXPLAIN SELECT 1 FROM t ORDER BY val <-> '{0.5,0.5,0.5}'::real[] limit 10;
QUERY PLAN
-----------------------------------------------------------------
Limit (cost=43.65..43.67 rows=10 width=8)
-> Sort (cost=43.65..46.15 rows=1001 width=8)
Sort Key: ((val <-> ('{0.5,0.5,0.5}'::real[])::vector))
-> Seq Scan on t (cost=0.00..22.01 rows=1000 width=8)