Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: access method "hnsw" does not exist #504

Open
timdonovanuk opened this issue Jun 18, 2024 · 1 comment
Open

ERROR: access method "hnsw" does not exist #504

timdonovanuk opened this issue Jun 18, 2024 · 1 comment

Comments

@timdonovanuk
Copy link

Hi,

Long story short, I'm accidentally running pgvetor 0.3-alpha and the app I'm using (immich) requires 0.2. I have not run into any issues apart from creating this index:

CREATE INDEX IF NOT EXISTS face_index ON asset_faces
    USING hnsw (embedding vector_cosine_ops)
    WITH (ef_construction = 300, m = 16);

where I get the error access method "hnsw" does not exist.

Indeed it does not exist:

SELECT amname AS index_method FROM pg_am WHERE amtype = 'i'

index_method:

btree
hash
gist
gin
spgist
brin
vectors

I've tried SET vectors.pgvector_compatibility=on too.

How do I create this index access method? Thank you

@cutecutecat
Copy link
Member

Hello, thanks for your report.
Yes, the access method hnsw does not exist in pgvecto.rs.
We support it by vectors.pgvector_compatibility and rewrite hnsw to vectors internally.

This feature requires SET vectors.pgvector_compatibility=on in current session.
Do you set it in the same session of CREATE INDEX like:

postgres=# CREATE TABLE t (val vector(3));
CREATE TABLE
postgres=# INSERT INTO t (val) SELECT ARRAY[random(), random(), random()]::real[] FROM generate_series(1, 1000);
INSERT 0 1000
postgres=# CREATE INDEX hnsw_l2_index ON t USING hnsw (val vector_l2_ops);
ERROR:  access method "hnsw" does not exist
postgres=# SET vectors.pgvector_compatibility=on;
SET
postgres=# CREATE INDEX hnsw_l2_index ON t USING hnsw (val vector_l2_ops);
CREATE INDEX
postgres=# 

Or ALTER SYSTEM SET vectors.pgvector_compatibility=on may help you to set it globally.

If that not worked, could you please show us some steps to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants