Overview
pgvector adds avector column type, distance operators, and approximate nearest-neighbor indexes (HNSW and IVFFlat) to PostgreSQL. Use it to store embeddings alongside relational data and query by similarity.
PlanetScale Postgres also supports pgvectorscale, a companion extension for higher-performance approximate search. See the supported extensions table for available versions.
Enabling pgvector
pgvector does not require a cluster restart. Install it with a role that has superuser privileges:Usage
Create a table with a vector column, insert embeddings, and query by distance:
Add an HNSW index when you need approximate search at scale:

