Added HNSW index type

This commit is contained in:
Andrew Kane
2023-07-21 16:25:39 -07:00
parent f210791846
commit f0760eee76
28 changed files with 3625 additions and 7 deletions

20
test/expected/hnsw_ip.out Normal file
View File

@@ -0,0 +1,20 @@
SET enable_seqscan = off;
CREATE TABLE t (val vector(3));
INSERT INTO t (val) VALUES ('[0,0,0]'), ('[1,2,3]'), ('[1,1,1]'), (NULL);
CREATE INDEX ON t USING hnsw (val vector_ip_ops);
INSERT INTO t (val) VALUES ('[1,2,4]');
SELECT * FROM t ORDER BY val <#> '[3,3,3]';
val
---------
[1,2,4]
[1,2,3]
[1,1,1]
[0,0,0]
(4 rows)
SELECT * FROM t ORDER BY val <#> (SELECT NULL::vector);
val
-----
(0 rows)
DROP TABLE t;