mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-26 15:49:58 +00:00
## Problem halfvec data type was introduced in pgvector 0.7.0 and is popular because it allows smaller vectors, smaller indexes and potentially better performance. So far we have not tested halfvec in our periodic performance tests. This PR adds halfvec indexing and halfvec queries to the test.
15 lines
459 B
SQL
15 lines
459 B
SQL
DROP TABLE IF EXISTS halfvec_test_table;
|
|
|
|
CREATE TABLE halfvec_test_table (
|
|
_id text NOT NULL,
|
|
title text,
|
|
text text,
|
|
embeddings halfvec(1536),
|
|
PRIMARY KEY (_id)
|
|
);
|
|
|
|
INSERT INTO halfvec_test_table (_id, title, text, embeddings)
|
|
SELECT _id, title, text, embeddings::halfvec
|
|
FROM documents;
|
|
|
|
CREATE INDEX documents_half_precision_hnsw_idx ON halfvec_test_table USING hnsw (embeddings halfvec_cosine_ops) WITH (m = 64, ef_construction = 128); |