Skip to content

koseemre/pgvector-benchmark

Repository files navigation

IVFFlat and HNSW Comparison in the Postgre's pgvector Extension

Start postgre sql & pgvector

docker run --cpus=2 -d --name pgvector -e POSTGRES_PASSWORD=xxxx -e PGDATA=pgdata -v pgvector_data:/var/lib/postgresql/data -p 5432:5432 pgvector

Set your custom database information to the .env file

Create tables

    CREATE TABLE IF NOT EXISTS public.mnist (id bigserial PRIMARY KEY, embedding vector(784));
    CREATE TABLE IF NOT EXISTS public.deep1b (id bigserial PRIMARY KEY, embedding vector(96));
    CREATE TABLE IF NOT EXISTS public.gist (id bigserial PRIMARY KEY, embedding vector(960));
    CREATE TABLE IF NOT EXISTS public.glove (id bigserial PRIMARY KEY, embedding vector(200));
    CREATE TABLE IF NOT EXISTS public.sift (id bigserial PRIMARY KEY, embedding vector(128));

Download data sets

Downloads 5 datasets from the address http://ann-benchmarks.com

python download_data.py

Insert data

python insert_data.py

Start experiments

The script below builds the index (if enabled in the settings), runs the experiments, and outputs the information to the /stats folder.

python process_experiment.py

Releases

No releases published

Packages

No packages published

Languages