Skip to content

Commit fef635c

Browse files
committed
Updated readme [skip ci]
1 parent 78ed8f1 commit fef635c

File tree

1 file changed

+21
-61
lines changed

1 file changed

+21
-61
lines changed

README.md

+21-61
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Get the nearest neighbors by L2 distance
8282
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
8383
```
8484

85-
Also supports inner product (`<#>`), cosine distance (`<=>`), and L1 distance (`<+>`, added in 0.7.0)
85+
Also supports inner product (`<#>`), cosine distance (`<=>`), and L1 distance (`<+>`)
8686

8787
Note: `<#>` returns the negative inner product since Postgres only supports `ASC` order index scans on operators
8888

@@ -146,9 +146,9 @@ Supported distance functions are:
146146
- `<->` - L2 distance
147147
- `<#>` - (negative) inner product
148148
- `<=>` - cosine distance
149-
- `<+>` - L1 distance (added in 0.7.0)
150-
- `<~>` - Hamming distance (binary vectors, added in 0.7.0)
151-
- `<%>` - Jaccard distance (binary vectors, added in 0.7.0)
149+
- `<+>` - L1 distance
150+
- `<~>` - Hamming distance (binary vectors)
151+
- `<%>` - Jaccard distance (binary vectors)
152152

153153
Get the nearest neighbors to a row
154154

@@ -235,19 +235,19 @@ Cosine distance
235235
CREATE INDEX ON items USING hnsw (embedding vector_cosine_ops);
236236
```
237237

238-
L1 distance - added in 0.7.0
238+
L1 distance
239239

240240
```sql
241241
CREATE INDEX ON items USING hnsw (embedding vector_l1_ops);
242242
```
243243

244-
Hamming distance - added in 0.7.0
244+
Hamming distance
245245

246246
```sql
247247
CREATE INDEX ON items USING hnsw (embedding bit_hamming_ops);
248248
```
249249

250-
Jaccard distance - added in 0.7.0
250+
Jaccard distance
251251

252252
```sql
253253
CREATE INDEX ON items USING hnsw (embedding bit_jaccard_ops);
@@ -256,9 +256,9 @@ CREATE INDEX ON items USING hnsw (embedding bit_jaccard_ops);
256256
Supported types are:
257257

258258
- `vector` - up to 2,000 dimensions
259-
- `halfvec` - up to 4,000 dimensions (added in 0.7.0)
260-
- `bit` - up to 64,000 dimensions (added in 0.7.0)
261-
- `sparsevec` - up to 1,000 non-zero elements (added in 0.7.0)
259+
- `halfvec` - up to 4,000 dimensions
260+
- `bit` - up to 64,000 dimensions
261+
- `sparsevec` - up to 1,000 non-zero elements
262262

263263
### Index Options
264264

@@ -312,7 +312,7 @@ Note: Do not set `maintenance_work_mem` so high that it exhausts the memory on t
312312

313313
Like other index types, it’s faster to create an index after loading your initial data
314314

315-
Starting with 0.6.0, you can also speed up index creation by increasing the number of parallel workers (2 by default)
315+
You can also speed up index creation by increasing the number of parallel workers (2 by default)
316316

317317
```sql
318318
SET max_parallel_maintenance_workers = 7; -- plus leader
@@ -365,7 +365,7 @@ Cosine distance
365365
CREATE INDEX ON items USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
366366
```
367367

368-
Hamming distance - added in 0.7.0
368+
Hamming distance
369369

370370
```sql
371371
CREATE INDEX ON items USING ivfflat (embedding bit_hamming_ops) WITH (lists = 100);
@@ -374,8 +374,8 @@ CREATE INDEX ON items USING ivfflat (embedding bit_hamming_ops) WITH (lists = 10
374374
Supported types are:
375375

376376
- `vector` - up to 2,000 dimensions
377-
- `halfvec` - up to 4,000 dimensions (added in 0.7.0)
378-
- `bit` - up to 64,000 dimensions (added in 0.7.0)
377+
- `halfvec` - up to 4,000 dimensions
378+
- `bit` - up to 64,000 dimensions
379379

380380
### Query Options
381381

@@ -547,8 +547,6 @@ Note: If this is lower than `ivfflat.probes`, `ivfflat.probes` will be used
547547

548548
## Half-Precision Vectors
549549

550-
*Added in 0.7.0*
551-
552550
Use the `halfvec` type to store half-precision vectors
553551

554552
```sql
@@ -557,8 +555,6 @@ CREATE TABLE items (id bigserial PRIMARY KEY, embedding halfvec(3));
557555

558556
## Half-Precision Indexing
559557

560-
*Added in 0.7.0*
561-
562558
Index vectors at half precision for smaller indexes
563559

564560
```sql
@@ -580,24 +576,16 @@ CREATE TABLE items (id bigserial PRIMARY KEY, embedding bit(3));
580576
INSERT INTO items (embedding) VALUES ('000'), ('111');
581577
```
582578

583-
Get the nearest neighbors by Hamming distance (added in 0.7.0)
579+
Get the nearest neighbors by Hamming distance
584580

585581
```sql
586582
SELECT * FROM items ORDER BY embedding <~> '101' LIMIT 5;
587583
```
588584

589-
Or (before 0.7.0)
590-
591-
```sql
592-
SELECT * FROM items ORDER BY bit_count(embedding # '101') LIMIT 5;
593-
```
594-
595585
Also supports Jaccard distance (`<%>`)
596586

597587
## Binary Quantization
598588

599-
*Added in 0.7.0*
600-
601589
Use expression indexing for binary quantization
602590

603591
```sql
@@ -620,8 +608,6 @@ SELECT * FROM (
620608

621609
## Sparse Vectors
622610

623-
*Added in 0.7.0*
624-
625611
Use the `sparsevec` type to store sparse vectors
626612

627613
```sql
@@ -655,8 +641,6 @@ You can use [Reciprocal Rank Fusion](https://github.com/pgvector/pgvector-python
655641

656642
## Indexing Subvectors
657643

658-
*Added in 0.7.0*
659-
660644
Use expression indexing to index subvectors
661645

662646
```sql
@@ -1171,6 +1155,12 @@ cd pgvector
11711155
docker build --pull --build-arg PG_MAJOR=17 -t myuser/pgvector .
11721156
```
11731157

1158+
If you increase `maintenance_work_mem`, make sure `--shm-size` is at least that size to avoid an error with parallel HNSW index builds.
1159+
1160+
```sh
1161+
docker run --shm-size=1g ...
1162+
```
1163+
11741164
### Homebrew
11751165

11761166
With Homebrew Postgres, you can use:
@@ -1258,36 +1248,6 @@ You can check the version in the current database with:
12581248
SELECT extversion FROM pg_extension WHERE extname = 'vector';
12591249
```
12601250

1261-
## Upgrade Notes
1262-
1263-
### 0.6.0
1264-
1265-
#### Postgres 12
1266-
1267-
If upgrading with Postgres 12, remove this line from `sql/vector--0.5.1--0.6.0.sql`:
1268-
1269-
```sql
1270-
ALTER TYPE vector SET (STORAGE = external);
1271-
```
1272-
1273-
Then run `make install` and `ALTER EXTENSION vector UPDATE;`.
1274-
1275-
#### Docker
1276-
1277-
The Docker image is now published in the `pgvector` org, and there are tags for each supported version of Postgres (rather than a `latest` tag).
1278-
1279-
```sh
1280-
docker pull pgvector/pgvector:pg16
1281-
# or
1282-
docker pull pgvector/pgvector:0.6.0-pg16
1283-
```
1284-
1285-
Also, if you’ve increased `maintenance_work_mem`, make sure `--shm-size` is at least that size to avoid an error with parallel HNSW index builds.
1286-
1287-
```sh
1288-
docker run --shm-size=1g ...
1289-
```
1290-
12911251
## Thanks
12921252

12931253
Thanks to:

0 commit comments

Comments
 (0)