p2d2 Pgvector Workshop
p2d2 Pgvector Workshop
●
Specialized vector data type
●
Indexing
●
Search capabilities
●
Distance operators
p2d2.pictures
id BIGSERIAL PLAIN
filename text EXTENDED
embedding vector(768) EXTERNAL
p2d2.pictures
id BIGSERIAL PLAIN
filename text EXTENDED
embedding vector(768) PLAIN
psql -d p2d2db42
CREATE EXTENSION vector;
\dx
https://www.kaggle.com/datasets/samuelcortinhas/muffin-vs-chihuahua-image-classification/
/home/dataset/chihuahua_muffin
https://www.kaggle.com/datasets/samuelcortinhas/muffin-vs-chihuahua-image-classification/
ibed = imgbeddings()
ibed.to_embeddings(img)
ibed.to_embeddings(img) conn.
ibed.to_embeddings(img) conn.commit()
./load_embeddings.py \
/home/dataset/chihuahua_muffin/muffin \
/var/run/postgresql 5432 p2d2db42 user42
●
HNSW
●
IVFFlat
●
HNSW
Hierarchical Navigable Small Worlds
●
IVFFlat
●
HNSW
Hierarchical Navigable Small Worlds
●
IVFFlat
InVerted File with Flat compression
●
HNSW
Hierarchical Navigable Small Worlds
●
IVFFlat
InVerted File with Flat compression
Inverted lists
connect
close
cursor
fetchall
Vector operator
●
Relational database designed for OLTP/OLAP
●
Multi-Version Concurrency Control
●
Relational database designed for OLTP/OLAP
●
Multi-Version Concurrency Control
●
Vertical Scalability
●
Shortcomings of specialized vector databases
– Lack of transactional support
– Difficult to combine queries with other filters
●
Shortcomings of specialized vector databases
– Lack of transactional support
– Difficult to combine queries with other filters
●
Integration with existing software
●
Shortcomings of specialized vector databases
– Lack of transactional support
– Difficult to combine queries with other filters
●
Integration with existing software
●
Integration with existing data
●
Shortcomings of specialized vector databases
– Lack of transactional support
– Difficult to combine queries with other filters
●
Integration with existing software
●
Integration with existing data
●
Established community
●
Shortcomings of specialized vector databases
– Lack of transactional support
– Difficult to combine queries with other filters
●
Integration with existing software
●
Integration with existing data
●
Established community – to be improved
●
Multi-disciplinary work
●
Multi-disciplinary work
●
pgvector already turns PostgreSQL into a vector
database
●
pgvector keeps improving
●
Multi-disciplinary work
●
pgvector already turns PostgreSQL into a vector
database
●
pgvector keeps improving
●
Look at the larger picture and collaborate