mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-23 04:20:56 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6420355c5 | ||
|
|
73356ecfa7 | ||
|
|
0e557b1d18 | ||
|
|
769a60884c | ||
|
|
8711840058 |
12
README.md
12
README.md
@@ -465,6 +465,16 @@ If filtering by many different values, consider [partitioning](https://www.postg
|
|||||||
CREATE TABLE items (embedding vector(3), category_id int) PARTITION BY LIST(category_id);
|
CREATE TABLE items (embedding vector(3), category_id int) PARTITION BY LIST(category_id);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Multitenancy
|
||||||
|
|
||||||
|
For applications with multiple tenants, sharing an approximate index between tenants means vectors from one tenant can affect recall (and speed) for other tenants.
|
||||||
|
|
||||||
|
For tenant isolation, use [list partitioning](https://www.postgresql.org/docs/current/ddl-partitioning.html) or separate tables.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE TABLE items (customer_id int, embedding vector(3)) PARTITION BY LIST(customer_id);
|
||||||
|
```
|
||||||
|
|
||||||
## Iterative Index Scans
|
## Iterative Index Scans
|
||||||
|
|
||||||
With approximate indexes, queries with filtering can return less results since filtering is applied *after* the index is scanned. Starting with 0.8.0, you can enable iterative index scans, which will automatically scan more of the index until enough results are found (or it reaches `hnsw.max_scan_tuples` or `ivfflat.max_probes`).
|
With approximate indexes, queries with filtering can return less results since filtering is applied *after* the index is scanned. Starting with 0.8.0, you can enable iterative index scans, which will automatically scan more of the index until enough results are found (or it reaches `hnsw.max_scan_tuples` or `ivfflat.max_probes`).
|
||||||
@@ -1223,7 +1233,7 @@ Note: Replace `18` with your Postgres server version
|
|||||||
Install the FreeBSD package with:
|
Install the FreeBSD package with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pkg install postgresql17-pgvector
|
pkg install postgresql18-pgvector
|
||||||
```
|
```
|
||||||
|
|
||||||
or the port with:
|
or the port with:
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ VectorArrayInit(int maxlen, int dimensions, Size itemsize)
|
|||||||
{
|
{
|
||||||
VectorArray res;
|
VectorArray res;
|
||||||
|
|
||||||
if (maxlen < 1 || dimensions < 1)
|
if (maxlen < 1 || dimensions < 1 || itemsize == 0)
|
||||||
elog(ERROR, "safety check failed");
|
elog(ERROR, "cannot create vector array");
|
||||||
|
|
||||||
/* Ensure items are aligned to prevent UB */
|
/* Ensure items are aligned to prevent UB */
|
||||||
itemsize = MAXALIGN(itemsize);
|
itemsize = MAXALIGN(itemsize);
|
||||||
|
|||||||
Reference in New Issue
Block a user