Skip to content

[Question] Using HNSW index requires using Euclidian Distance Operator? #152

Closed
@john0isaac

Description

@john0isaac

Description

You have this comment from the pgvector playgroud repo

# Define HNSW index to support vector similarity search through the vector_l2_ops access method (Euclidean distance). The SQL operator for Euclidean distance is written as <->.

Does it mean that the HNSW index will only work with <-> operator?

Since here in the repo you are using the cosine similarity operator not the <->

SELECT id, RANK () OVER (ORDER BY {self.embedding_column} <=> :embedding) AS rank

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions