Skip to content

Commit 2b91974

Browse files
authored
1.0.0 (#154)
Signed-off-by: usamoi <usamoi@outlook.com>
1 parent 2f1fae2 commit 2b91974

File tree

9 files changed

+76
-38
lines changed

9 files changed

+76
-38
lines changed

.vitepress/config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export default defineConfig({
199199
{ text: 'Prewarm', link: '/vectorchord/usage/prewarm' },
200200
{ text: 'Prefilter', link: '/vectorchord/usage/prefilter' },
201201
{ text: 'Prefetch', link: '/vectorchord/usage/prefetch' },
202-
{ text: 'Rerank In Table', link: '/vectorchord/usage/rerank-in-table' },
202+
{ text: 'Rerank in Table', link: '/vectorchord/usage/rerank-in-table' },
203203
{ text: 'External Build', link: '/vectorchord/usage/external-index-precomputation' },
204204
]
205205
},

src/vectorchord/admin/kubernetes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ tensorchord=> \dx
151151
Name | Version | Schema | Description
152152
---------+---------+------------+---------------------------------------------------------------------------------------------
153153
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
154-
vchord | 0.5.3 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
154+
vchord | 1.0.0 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
155155
vector | 0.8.1 | public | vector data type and ivfflat and hnsw access methods
156156
(3 rows)
157157
```
@@ -216,7 +216,7 @@ spec:
216216
extensions:
217217
- name: vchord
218218
image:
219-
reference: ghcr.io/tensorchord/vchord-scratch:pg18-v0.5.3
219+
reference: ghcr.io/tensorchord/vchord-scratch:pg18-v1.0.0
220220
dynamic_library_path:
221221
- /usr/lib/postgresql/18/lib/
222222
extension_control_path:
@@ -243,7 +243,7 @@ tensorchord=> \dx
243243
Name | Version | Schema | Description
244244
---------+---------+------------+---------------------------------------------------------------------------------------------
245245
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
246-
vchord | 0.5.3 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
246+
vchord | 1.0.0 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
247247
vector | 0.8.1 | public | vector data type and ivfflat and hnsw access methods
248248
(3 rows)
249249

src/vectorchord/getting-started/installation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ docker run \
2828
--name vchord-demo \
2929
-e POSTGRES_PASSWORD=mysecretpassword \
3030
-p 5432:5432 \
31-
-d tensorchord/vchord-postgres:pg18-v0.5.3
31+
-d tensorchord/vchord-postgres:pg18-v1.0.0
3232
```
3333

3434
2. Connect to the database using the `psql` command line tool. The default username is `postgres`.
@@ -81,7 +81,7 @@ Other sections may align with the above.
8181
We provide a scratch image that contains only the files of VectorChord. You can install VectorChord in any image using Docker's `COPY`, like
8282

8383
```dockerfile
84-
FROM tensorchord/vchord-scratch:pg18-v0.5.3 AS vchord_scratch
84+
FROM tensorchord/vchord-scratch:pg18-v1.0.0 AS vchord_scratch
8585
FROM postgres:18-bookworm
8686
RUN apt-get update && apt-get install -y postgresql-18-pgvector
8787
COPY --from=vchord_scratch / /
@@ -118,8 +118,8 @@ If you have not installed PostgreSQL yet, please install PostgreSQL. If you have
118118
1. Download the source code, build and install it with `make`.
119119

120120
```sh
121-
curl -fsSL https://github.com/tensorchord/VectorChord/archive/refs/tags/0.5.3.tar.gz | tar -xz
122-
cd VectorChord-0.5.3
121+
curl -fsSL https://github.com/tensorchord/VectorChord/archive/refs/tags/1.0.0.tar.gz | tar -xz
122+
cd VectorChord-1.0.0
123123
make build
124124
make install # or `sudo make install`
125125
```
@@ -161,7 +161,7 @@ Please note that binaries generated with a specific `target-cpu` are not compati
161161
You can also do it by using Cargo's configuration.
162162

163163
```sh
164-
cd VectorChord-0.5.3
164+
cd VectorChord-1.0.0
165165
mkdir -p .cargo
166166
touch .cargo/config.toml
167167
echo 'build.rustflags = ["-Ctarget-cpu=icelake"]' >> ./cargo/config.toml
@@ -174,8 +174,8 @@ If you have not installed PostgreSQL yet, please install PostgreSQL following ht
174174
1. Download Debian packages in [the release page](https://github.com/tensorchord/VectorChord/releases/latest), and install them by `apt`.
175175

176176
```sh
177-
wget https://github.com/tensorchord/VectorChord/releases/download/0.5.3/postgresql-18-vchord_0.5.3-1_$(dpkg --print-architecture).deb
178-
sudo apt install ./postgresql-18-vchord_0.5.3-1_$(dpkg --print-architecture).deb
177+
wget https://github.com/tensorchord/VectorChord/releases/download/1.0.0/postgresql-18-vchord_1.0.0-1_$(dpkg --print-architecture).deb
178+
sudo apt install ./postgresql-18-vchord_1.0.0-1_$(dpkg --print-architecture).deb
179179
```
180180

181181
2. Configure your PostgreSQL by modifying the `shared_preload_libraries` to include the extension. And then restart the PostgreSQL cluster.
@@ -198,8 +198,8 @@ If you have not installed PostgreSQL yet, please install PostgreSQL following ht
198198
1. Download Debian packages in [the release page](https://github.com/tensorchord/VectorChord/releases/latest), and install them by `apt`.
199199

200200
```sh
201-
wget https://github.com/tensorchord/VectorChord/releases/download/0.5.3/postgresql-18-vchord_0.5.3-1_$(dpkg --print-architecture).deb
202-
sudo apt install ./postgresql-18-vchord_0.5.3-1_$(dpkg --print-architecture).deb
201+
wget https://github.com/tensorchord/VectorChord/releases/download/1.0.0/postgresql-18-vchord_1.0.0-1_$(dpkg --print-architecture).deb
202+
sudo apt install ./postgresql-18-vchord_1.0.0-1_$(dpkg --print-architecture).deb
203203
```
204204

205205
2. Configure your PostgreSQL by modifying the `shared_preload_libraries` to include the extension. And then restart the PostgreSQL cluster.

src/vectorchord/getting-started/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ docker run \
3737
--name vectorchord-demo \
3838
-e POSTGRES_PASSWORD=mysecretpassword \
3939
-p 5432:5432 \
40-
-d tensorchord/vchord-postgres:pg18-v0.5.3
40+
-d tensorchord/vchord-postgres:pg18-v1.0.0
4141
```
4242
> In addition to the base image with the VectorChord extension, we provide an all-in-one image, `tensorchord/vchord-suite:pg18-latest`. This comprehensive image includes all official TensorChord extensions. Developers should select an image tag that is compatible with their extension's version, as indicated in [the support matrix](https://github.com/tensorchord/VectorChord-images?tab=readme-ov-file#support-matrix).
4343
@@ -86,7 +86,7 @@ For more usage, please read:
8686
- [Prewarm](/vectorchord/usage/prewarm)
8787
- [Prefilter](/vectorchord/usage/prefilter)
8888
- [Prefetch](/vectorchord/usage/prefetch)
89-
- [Rerank In Table](/vectorchord/usage/rerank-in-table)
89+
- [Rerank in Table](/vectorchord/usage/rerank-in-table)
9090
- [External Build](/vectorchord/usage/external-index-precomputation)
9191

9292
## License

src/vectorchord/getting-started/vectorchord-suite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ CREATE EXTENSION IF NOT EXISTS pg_tokenizer CASCADE;
5757
CREATE EXTENSION IF NOT EXISTS vchord_bm25 CASCADE;
5858
\dx
5959
pg_tokenizer | 0.1.1 | tokenizer_catalog | pg_tokenizer
60-
vchord | 0.5.3 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
60+
vchord | 1.0.0 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
6161
vchord_bm25 | 0.2.2 | bm25_catalog | vchord_bm25: A postgresql extension for bm25 ranking algorithm
6262
vector | 0.8.1 | public | vector data type and ivfflat and hnsw access methods
6363
```

src/vectorchord/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- [Prewarm](/vectorchord/usage/prewarm)
1919
- [Prefilter](/vectorchord/usage/prefilter)
2020
- [Prefetch](/vectorchord/usage/prefetch)
21-
- [Rerank In Table](/vectorchord/usage/rerank-in-table)
21+
- [Rerank in Table](/vectorchord/usage/rerank-in-table)
2222
- [External Build](/vectorchord/usage/external-index-precomputation)
2323

2424
## Use Cases

src/vectorchord/usage/indexing.md

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,23 @@ SET vchordrq.probes TO '10';
8888
SELECT * FROM items ORDER BY embedding <=> '[3,1,2]' LIMIT 10;
8989
```
9090

91-
For large tables, the `build.internal` process costs huge time and memory. You can refer to [External Build](external-index-precomputation) to have a better experience.
92-
93-
For large tables, you may opt to use more shared memory to accelerate the process by setting `build.pin` to `true`.
91+
For large tables, you may opt to use more shared memory to accelerate the process by setting `build.pin` to `2`.
9492

9593
```sql
9694
CREATE INDEX ON items USING vchordrq (embedding vector_l2_ops) WITH (options = $$
9795
residual_quantization = true
98-
build.pin = true
96+
build.pin = 2
9997
[build.internal]
10098
lists = [1000]
10199
spherical_centroids = true
102100
build_threads = 8
103101
$$);
104102
```
105103

104+
For large tables, the `build.internal` process costs significant time and memory. Let `build.internal.kmeans_dimension` or the dimension be $D$, `build.internal.lists[-1]` be $C$, `build.internal.sampling_factor` be $F$, and `build.internal.build_threads` be $T$. The memory consumption is approximately $4CD(F + T + 1)$ bytes. You can moderately reduce these options for lower memory usage.
105+
106+
You can also refer to [External Build](external-index-precomputation) to offload the indexing workload to other machines.
107+
106108
## Reference
107109

108110
### Operator Classes <badge type="info" text="vchordrq" /> {#operator-classes}
@@ -140,21 +142,40 @@ The operator classes for `MaxSim` are available since version `0.3.0`.
140142

141143
#### `residual_quantization`
142144

143-
- Description: This index parameter determines whether residual quantization is used. If you not familiar with residual quantization, you can read this [blog](https://drscotthawley.github.io/blog/posts/2023-06-12-RVQ.html) for more information. In short, residual quantization is a technique that improves the accuracy of vector search by quantizing the residuals of the vectors.
145+
- Description: This option determines whether residual quantization is used. If you are not familiar with residual quantization, you can read this [blog](https://drscotthawley.github.io/blog/posts/2023-06-12-RVQ.html) for more information. In short, residual quantization is a technique that improves the accuracy of vector search by quantizing the residuals of the vectors.
144146
- Type: boolean
145147
- Default: `false`
146148
- Example:
147149
- `residual_quantization = false` means that residual quantization is not used.
148150
- `residual_quantization = true` means that residual quantization is used.
149151

152+
#### `degree_of_parallelism` <badge type="tip" text="since v1.0.0" />
153+
154+
- Description: This option is a hint that specifies the degree of parallelism. In most cases, you do not need to change it. If you are using a CPU with more than `32` threads and wish to utilize more threads for PostgreSQL, you may set it to the number of threads for better performance.
155+
- Type: integer
156+
- Default: `32`
157+
- Domain: `[1, 256]`
158+
- Example:
159+
- `degree_of_parallelism = 32` hints to the index that `32` or less processes may access on the index concurrently.
160+
- `degree_of_parallelism = 64` hints to the index that `64` or less processes may access on the index concurrently.
161+
150162
#### `build.pin` <badge type="tip" text="since v0.2.1" />
151163

152-
- Description: This index parameter determines whether shared memory is used for indexing. For large tables, you can choose to enable this option to speed up the build process.
153-
- Type: boolean
154-
- Default: `false`
164+
- Description: This option determines whether shared memory is used for indexing. For large tables, you can choose to enable this option to speed up the build process.
165+
- Type: union of integer and boolean
166+
- Default:
167+
- `-1` <badge type="tip" text="since v1.0.0" />
168+
- `false` <badge type="tip" text="until v0.5.3" />
169+
- Domain:
170+
- `{-1, 0, 1, 2, false, true}` <badge type="tip" text="since v1.0.0" />
171+
- `{false, true}` <badge type="tip" text="until v0.5.3" />
155172
- Example:
156-
- `build.pin = false` means that shared memory is not used.
157-
- `build.pin = true` means that shared memory is used.
173+
- `build.pin = 2` means the hot portion of the index is cached in memory.
174+
- `build.pin = 1` means a subset of the hot portion of the index is cached in memory, consuming less memory.
175+
- `build.pin = 0` means that this feature is enabled but nothing is actually cached. This option is for debugging purposes only.
176+
- `build.pin = -1` means that this feature is disabled.
177+
- `build.pin = false` is the legacy form of `build.pin = -1`.
178+
- `build.pin = true` is the legacy form of `build.pin = 1`.
158179

159180
### Default Build Options <badge type="tip" text="since v0.5.3" />
160181

@@ -164,7 +185,7 @@ This is the default value of index building. The index will not be partitioned.
164185

165186
#### `build.internal.lists`
166187

167-
- Description: This index parameter determines the hierarchical structure of the vector space partitioning.
188+
- Description: This option determines the hierarchical structure of the vector space partitioning.
168189
- Type: list of integers
169190
- Default:
170191
- `[]` <badge type="tip" text="since v0.3.0" />
@@ -173,11 +194,11 @@ This is the default value of index building. The index will not be partitioned.
173194
- `build.internal.lists = []` means that the vector space is not partitioned.
174195
- `build.internal.lists = [4096]` means the vector space is divided into $4096$ cells.
175196
- `build.internal.lists = [4096, 262144]` means the vector space is divided into $4096$ cells, and those cells are further divided into $262144$ smaller cells.
176-
- Note: The index partitions the vector space into multiple Voronoi cells based on centroids, iteratively creating a hierarchical space partition tree. Each leaf node in this tree represents a region with an associated list storing vectors in that region. During insertion, vectors are placed in lists corresponding to their appropriate leaf nodes. For queries, the index optimizes search by excluding lists whose leaf nodes are distant from the query vector, effectively pruning the search space. If the length of `lists` is $1$, the `lists` option should be no less than $4 * \sqrt{N}$, where $N$ is the number of vectors in the table.
197+
- Note: The index partitions the vector space into multiple Voronoi cells based on centroids, iteratively creating a hierarchical space partition tree. Each leaf node in this tree represents a region with an associated list storing vectors in that region. During insertion, vectors are placed in lists corresponding to their appropriate leaf nodes. For queries, the index optimizes search by excluding lists whose leaf nodes are distant from the query vector, effectively pruning the search space. If the length of `lists` is $1$, the `lists` option should be no less than $4\sqrt{N}$, where $N$ is the number of vectors in the table.
177198

178199
#### `build.internal.spherical_centroids`
179200

180-
- Description: This index parameter determines whether to perform spherical K-means -- the centroids are L2 normalized after each iteration, you can refer to option `spherical` in [here](https://github.com/facebookresearch/faiss/wiki/Faiss-building-blocks:-clustering,-PCA,-quantization#additional-options).
201+
- Description: This option determines whether to perform spherical K-means -- the centroids are L2 normalized after each iteration, you can refer to option `spherical` in [here](https://github.com/facebookresearch/faiss/wiki/Faiss-building-blocks:-clustering,-PCA,-quantization#additional-options).
181202
- Type: boolean
182203
- Default: `false`
183204
- Example:
@@ -187,17 +208,17 @@ This is the default value of index building. The index will not be partitioned.
187208

188209
#### `build.internal.sampling_factor` <badge type="tip" text="since v0.2.0" />
189210

190-
- Description: This index parameter determines the number of vectors the K-means algorithm samples per cluster. The higher this value, the slower the build, the greater the memory consumption in building, and the better search performance.
211+
- Description: This option determines the number of vectors the K-means algorithm samples per cluster. The higher this value, the slower the build, the greater the memory consumption in building, and the better search performance.
191212
- Type: integer
192213
- Domain: `[0, 1024]`
193214
- Default: `256`
194215
- Example:
195216
- `build.internal.sampling_factor = 256` means that the K-means algorithm samples $256 C$ vectors, where $C$ is the maximum value in `build.internal.lists`.
196-
- `build.internal.sampling_factor = 1024` means that the K-means algorithm samples $1024 C$ vectors, where $C$ is the maximum value in `build.internal.lists`.
217+
- `build.internal.sampling_factor = 32` means that the K-means algorithm samples $32 C$ vectors, where $C$ is the maximum value in `build.internal.lists`. This reduces K-means' time and memory usage to approximately $\frac{1}{8}$ of what it would be with the default value of `256`.
197218

198219
#### `build.internal.kmeans_iterations` <badge type="tip" text="since v0.2.2" />
199220

200-
- Description: This index parameter determines the number of iterations for K-means algorithm. The higher this value, the slower the build.
221+
- Description: This option determines the number of iterations for K-means algorithm. The higher this value, the slower the build.
201222
- Type: integer
202223
- Domain: `[0, 1024]`
203224
- Default: `10`
@@ -207,14 +228,31 @@ This is the default value of index building. The index will not be partitioned.
207228

208229
#### `build.internal.build_threads`
209230

210-
- Description: This index parameter determines the number of threads used by K-means algorithm. The higher this value, the faster the build, and greater load on the server in building.
231+
- Description: This option determines the number of threads used by K-means algorithm. The higher this value, the faster the build, and greater load on the server in building.
211232
- Type: integer
212233
- Domain: `[1, 255]`
213234
- Default: `1`
214235
- Example:
215236
- `build.internal.build_threads = 1` means that the K-means algorithm uses $1$ thread.
216237
- `build.internal.build_threads = 4` means that the K-means algorithm uses $4$ threads.
217238

239+
#### `build.internal.kmeans_algorithm` <badge type="tip" text="since v1.0.0" />
240+
241+
- Description: This option determines the K-means algorithm to be used.
242+
- Type: object
243+
- Example:
244+
- `build.internal.kmeans_algorithm.lloyd = {}`. This uses Lloyd's algorithm. This is the default value.
245+
- `build.internal.kmeans_algorithm.hierarchical = {}`. This uses hierarchical clustering. Compared to Lloyd's algorithm, this approach is much faster, but it may cause a loss of accuracy.
246+
247+
#### `build.internal.kmeans_dimension` <badge type="tip" text="since v1.0.0" />
248+
249+
- Description: This option determines the dimension to use for K-means input and output. This feature employs dimensionality reduction and expansion via resampling, effectively reducing K-means' time and memory consumption, but it may cause a loss of accuracy.
250+
- Type: union of integer and null
251+
- Default: null
252+
- Example:
253+
- If this option is not set, this feature is disabled.
254+
- `build.internal.kmeans_dimension = 100` means that K-means will process vectors with $100$ dimensions. For original vectors of $900$ dimensions, this reduces K-means' time and memory usage to approximately $\frac{1}{9}$ of what it would be without this feature.
255+
218256
### Search Parameters <badge type="info" text="vchordrq" /> {#search-parameters}
219257

220258
#### `vchordrq.enable_scan` <badge type="tip" text="since v0.5.0" />
@@ -250,7 +288,7 @@ This is the default value of index building. The index will not be partitioned.
250288
- `SET vchordrq.epsilon = 0.1` indicates you are using a very optimistic lower bound estimation. You set it this way because your dataset is not sensitive to the lower bound estimation, for the precision you need.
251289
- `SET vchordrq.epsilon = 4.0` indicates you are using a very pessimistic lower bound estimation. You set it this way because your dataset is not very sensitive to the lower bound estimation, for the precision you need.
252290

253-
#### `vchordrq.prewarm_dim` <badge type="danger" text="deprecated in v0.4.0" />
291+
#### `vchordrq.prewarm_dim` <badge type="danger" text="removed in v0.4.0" />
254292

255293
- Description: The `vchordrq.prewarm_dim` GUC parameter is used to precompute the RaBitQ projection matrix for the specified dimensions. This can help to reduce the latency of the first query after the PostgreSQL cluster is started.
256294
- Type: list of integers

src/vectorchord/usage/measure-recall.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Measure Recall
1+
# Measure Recall <badge type="tip" text="since v0.5.0" />
22

33
In the context of vector search, recall is the ratio of true nearest neighbors to approximate nearest neighbors returned by the index. For example, if the index retrieves $100$ approximate nearest neighbors and $97$ of them are true nearest neighbors, then the recall is $\frac{97}{100} = 0.97$.
44

0 commit comments

Comments
 (0)