Top
Enterprise Postgres 17 SP1 Knowledge DataManagement FeatureUser's Guide

2.4 Performance Tuning for Similar Search of Vector Data

You can verify that indexes are being used for similar searches of vector data by checking the access plan in the EXPLAIN statement.

Example) Access Plan for Vector Similar Search

Here is an example using pgvectorscale:

EXPLAIN SELECT * FROM items ORDER BY embedding <=> '[3,1,2]' LIMIT 5;
                                      QUERY PLAN
---------------------------------------------------------------------------------------
Limit  (cost=24.75..24.96 rows=5 width=33)
   ->  Index Scan using idx_diskann  on items  (cost=24.75..445.75 rows=10000 width=33)
         Order By: (embedding <=> '[3,1,2]'::vector)
(3 rows)

See

Each vector index has parameters for tuning. See the documentation for pgvector and pgvectorscale for details.