11# PgVector
22
3- [ PgVector] ( https://github.com/pgvector/pgvector ) is an open-source vector similarity search for PostgreSQL.
3+ [ PgVector] ( https://github.com/pgvector/pgvector ) is an open-source extension
4+ that enables ** vector similarity search** in PostgreSQL.
45
5- ## How It Works
6+ This image provides a convenient way to deploy and manage ` pgvector ` with
7+ [ CloudNativePG] ( https://cloudnative-pg.io/ ) .
68
7- To use this extension container image, first add it to your Cluster.
8- For example:
9+ ## Usage
10+
11+ ### 1. Add the PgVector extension image to your Cluster
12+
13+ Define the ` pgvector ` extension under the ` postgresql.extensions ` section of
14+ your ` Cluster ` resource. For example:
915
1016``` yaml
1117apiVersion : postgresql.cnpg.io/v1
@@ -21,13 +27,15 @@ spec:
2127
2228 postgresql :
2329 extensions :
24- - name : pgvector
25- image :
26- reference : ghcr.io/cloudnative-pg/pgvector:0.8.1-18-trixie
30+ - name : pgvector
31+ image :
32+ reference : ghcr.io/cloudnative-pg/pgvector:0.8.1-18-trixie
2733` ` `
2834
29- Then, create or add it to an existing Database object to install the extension in a target database.
30- For example, to add it to the ` app` Database:
35+ ### 2. Enable the extension in a database
36+
37+ You can install ` pgvector` in a specific database by creating or updating a
38+ `Database` resource. For example, to enable it in the `app` database :
3139
3240` ` ` yaml
3341apiVersion: postgresql.cnpg.io/v1
4250 extensions:
4351 - name: vector
4452` ` `
53+
54+ # ## 3. Verify installation
55+
56+ Once the database is ready, connect to it with `psql` and run :
57+
58+ ` ` ` sql
59+ \d x
60+ ` ` `
61+
62+ You should see `vector` listed among the installed extensions.
0 commit comments