Top
Enterprise Postgres 17 SP1 Knowledge DataManagement FeatureUser's Guide

2.2 Storing and Seaching Vector Data

The vector data management feature provides a new vector data type for storing vector data. Create a table with columns of vector data type and store vector data.

The similarity search of vector data is performed by calculating the distance between two vector data using the distance operator added by the vector data management feature, and by the closeness and ordering of the calculated distance.

Example) Vector similarity search

SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' < 5 LIMIT 5;

Creating a vector index on a column of the vector data type causes the vector index to be used when searching for similarities using the distance operator.

Point

Similarity searches using vector index are approximate similarity searches.

See

Refer to the pgvector documentation for information about vector data types, vector operations, distance types between vectors, and HNSW and IVFFlat vector indexes.