mirror of
https://github.com/pgvector/pgvector.git
synced 2026-12-04 16:28:40 +00:00
Improved docs on indexing vectors with different dimensions [skip ci]
This commit is contained in:
1 parent
3d8c1921aa
commit
f361bf2704
1 file changed
+1
-1
@@ -413,7 +413,7 @@ You’ll need to use [dimensionality reduction](https://en.wikipedia.org/wiki/Di
|
||||
|
||||
#### Can I store vectors with different dimensions in the same column?
|
||||
|
||||
You can use the `vector` type (instead of `vector(3)`). However, to index the column, you’ll need to use an [expression](https://www.postgresql.org/docs/current/indexes-expressional.html) to set the number of dimensions and a partial index to filter rows with different dimensions.
|
||||
You can use the `vector` type (instead of `vector(3)`). However, you can only create indexes on rows with the same number of dimensions (using [partial indexing](https://www.postgresql.org/docs/current/indexes-partial.html) on an [expression](https://www.postgresql.org/docs/current/indexes-expressional.html)).
|
||||
|
||||
```sql
|
||||
CREATE INDEX ON items USING hnsw ((embedding::vector(3)) vector_l2_ops) WHERE (model_id = 123);
|
||||
|
||||
Reference in new issue
Block a user