pgvector.git / summary / log / commit / refs
commit 5986862bd2d564b5247f728a58caeed24f3e8f7e
Author: Andrew Kane <andrew@ankane.org>
Date: Sat Nov 04 22:01:37 2023 +0000
Added note about check constraint [skip ci]
README.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/README.md b/README.md
index a7cf5190..bca3de84 100644
--- a/README.md
+++ b/README.md
@@ -442,6 +442,12 @@ CREATE TABLE items (id bigserial PRIMARY KEY, embedding double precision[]);
INSERT INTO items (embedding) VALUES ('{1,2,3}'), ('{4,5,6}');
```
+Optionally, add a [check constraint](https://www.postgresql.org/docs/current/ddl-constraints.html) to ensure data can be converted to the `vector` type and has the expected dimensions.
+
+```sql
+ALTER TABLE items ADD CHECK (vector_dims(embedding::vector) = 3);
+```
+
Use [expression indexing](https://www.postgresql.org/docs/current/indexes-expressional.html) to index (at a lower precision):
```sql
[parent: 5d24f5d09a10]