pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #849: increase maximum dimension size for HNSW index
Date: Wed, 04 Jun 2025 14:44:07 +0000
Message-ID: <gh-pgvector-pgvector-849-c2940324705@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-849@github.com>
References: <gh-pgvector-pgvector-849@github.com>

This won't work as expected, as the tuple will exceed the page boundary. The technique to use for this is cast the indexed vector to `halfvec`. There's an [example here](https://jkatz05.com/post/postgres/pgvector-scalar-binary-quantization/), using the cosine distance:

```sql
CREATE TABLE documents (
    id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    content text,
    embedding vector(3072)
);

CREATE INDEX ON documents
    USING hnsw ((embedding::halfvec(3072)) halfvec_cosine_ops);
```

view thread (3+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-849-c2940324705@github.com>
Permalink:  ../gh-pgvector-pgvector-849-c2940324705@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox