Store embeddings alongside relational data
How RDS for PostgreSQL stores and searches embeddings with pgvector, using vector indexes and database capacity to meet workload requirements. · associate
Amazon RDS for PostgreSQL can store and search embeddings using the pgvector extension. An embedding is a list of numbers that represents content for similarity comparisons. An embedding model generates these numbers outside the database; pgvector stores them and calculates distances between them.
Choose an RDS PostgreSQL version that supports the required pgvector features, then enable the extension in your database with CREATE EXTENSION vector; using an appropriately privileged database role. A table can keep an identifier, source text, metadata, and an embedding together. For example, CREATE TABLE items (id bigint PRIMARY KEY, content text, category text, embedding vector(3)); creates a small teaching example.
The dimension is the number of values in each embedding: vector(3) requires three. In a real application, use the dimension produced by your model. Generate stored embeddings and query embeddings with the same model and compatible settings; equal dimensions alone do not make embeddings from different models comparable.