The following are the steps and guide in how to install and setup Vectorchord extension in your EDB EPAS PostgreSQL cluster.
First, you will need to install the two RPM packages for PgVector and VectorChord from EDB Latest package repositories.
Execute the following command to check that two packages are installed on your redhat operating system:
rpm -qa ‘*edb*’ | grep vect
edb-as16-pgvector0-0.8.2-1.el8.x86_64
edb-as16-vectorchord-1.1.1-1.el8.x86_64
After that, you will need to install both extensions as “admin” and set it up as follows:
postgres=# ALTER SYSTEM SET shared_preload_libraries = “vchord”;
postgres=# CREATE EXTENSION IF NOT EXISTS vector;
postgres=# create extension vchord;
Then, reboot the whole database instance cluster and then verify that extensions were installed successfully by executing the following:
postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
——————–+———+————+———————————————————————————————
edbspl | 1.0 | pg_catalog | EDB-SPL procedural language
pg_stat_statements | 1.10 | public | track planning and execution statistics of all SQL statements executed
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
vchord | 1.1.1 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
vector | 0.8.2 | public | vector data type and ivfflat and hnsw access methods
(5 rows)
After that perform testing at a user-database level (ensure the 2 extensions are created at database level):
postgres=# \c dummy
You are now connected to database “dummy” as user “enterprisedb”.
dummy=# \dx
List of installed extensions
Name | Version | Schema | Description
———+———+————+———————————————————————————————
edbspl | 1.0 | pg_catalog | EDB-SPL procedural language
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
vchord | 1.1.1 | public | vchord: Vector database plugin for Postgres, written in Rust, specifically designed for LLM
vector | 0.8.2 | public | vector data type and ivfflat and hnsw access methods
Now, create a table and insert a dummy data for verification and simulation:
CREATE TABLE items (id bigserial PRIMARY KEY, embedding rabitq8(3));
CREATE INDEX ON items USING vchordrq (embedding rabitq8_l2_ops);
INSERT INTO items (embedding) VALUES (quantize_to_rabitq8(‘[0,0,0]’::vector));
INSERT INTO items (embedding) VALUES (quantize_to_rabitq8(‘[1,1,1]’::vector));
INSERT INTO items (embedding) VALUES (quantize_to_rabitq8(‘[2,2,2]’::vector));
SELECT id FROM items ORDER BY embedding <-> quantize_to_rabitq8(‘[0.9,0.9,1.1]’::vector) LIMIT 100;