LoginSignup
1
1

Run pgvector in docker

Posted at
  • docker pull ankane/pgvector

  • docker run --name mypgvector -e POSTGRES_PASSWORD=654321 -p 5433:5432 -d ankane/pgvector

  • Use DBeaver to connect pgvector, host:localhost, port:5433, username:postgres, password:654321

  • Run SQL:

CREATE EXTENSION vector;
CREATE TABLE test1 (id bigserial PRIMARY KEY, name VARCHAR(100), embedding vector(3));
INSERT INTO test1 (name,embedding) VALUES ('a','[1,2,3]'), ('b','[4,5,6]'), ('c','[7,8,9]');
SELECT * FROM test1 ORDER BY embedding <-> '[3,4,5]';
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1