I created IVF Flat Index and HNSW index on the same column i.e.product embeddings ...got info from postgress that query planner will use index in case of multi indexed columns based on cost. However, when i do explain analyze for 10 query texts...i always got HNSW index used everytime...do HNSW index always having less cost compared to IVF Index???
cur.execute("""
EXPLAIN ANALYZE
SELECT *
FROM product_embeddings_table
ORDER BY product_embeddings <-> %s
LIMIT 10
""", (query_vector,))
Fetch the query execution plan
explain_results = cur.fetchall()
for row in explain_results:
print(row)
I created IVF Flat Index and HNSW index on the same column i.e.product embeddings ...got info from postgress that query planner will use index in case of multi indexed columns based on cost. However, when i do explain analyze for 10 query texts...i always got HNSW index used everytime...do HNSW index always having less cost compared to IVF Index???
cur.execute("""
EXPLAIN ANALYZE
SELECT *
FROM product_embeddings_table
ORDER BY product_embeddings <-> %s
LIMIT 10
""", (query_vector,))
Fetch the query execution plan
explain_results = cur.fetchall()
for row in explain_results:
print(row)