Add hibernate-vector module: pgvector similarity search with Hibernate 7.4.17.Final and Spring Data JPA 4.2.0 (float[] to vector/halfvec, cosine and L2 in HQL and Criteria, SearchResults methods, HNSW plans from auto_explain and five ways a query stops using the index, recall vs hnsw.ef_search, filtered-search row loss, Spring AI PgVectorStore comparison; PostgreSQL 16.15, pgvector 0.8.7)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4XrpfdpsacrvqnrBM
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
# HNSW is approximate: recall against exact search, hnsw.ef_search, LIMIT above ef_search, and filtered queries
|
||||
# Hibernate ORM 7.4.17.Final (on the classpath), PostgreSQL 16.15, pgvector 0.8.7, JDK 25
|
||||
100 query vectors, top 10 each, cosine distance, index chunk_hnsw_cos (m = 16, ef_construction = 64)
|
||||
|
||||
== 1. Recall@10 and latency by hnsw.ef_search (the default is 40)
|
||||
ef_search recall@10 avg ms per query (indicative)
|
||||
10 0.725 2.97
|
||||
20 0.874 2.01
|
||||
40 0.966 2.80
|
||||
100 0.995 3.38
|
||||
200 0.999 3.04
|
||||
|
||||
== 2. LIMIT 100 with the default ef_search = 40
|
||||
rows requested: 100, rows returned: 40
|
||||
with hnsw.ef_search = 200: rows returned: 100
|
||||
|
||||
== 3. Filter plus nearest neighbour: where c.category = 3 (10% of the rows), LIMIT 10
|
||||
default settings: 4.2 rows returned on average (10 asked for)
|
||||
SET hnsw.iterative_scan = relaxed_order: 10.0 rows returned on average
|
||||
first query vector, default settings: 6 rows
|
||||
Reference in New Issue
Block a user