From: dpresonate (@dpresonate) <noreply+dpresonate@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #716: LIMIT clause is not Respected > 40 < 2575
Date: Fri, 22 Nov 2024 20:16:51 +0000
Message-ID: <gh-pgvector-pgvector-716@github.com> (raw)
Noticing some unexpected behavior when I run a query. I am using the following query:
```SQL
SELECT *, embedding <=> ('[...]') AS distance FROM public.<table>
WHERE embedding <=> ('[...]') < ('1.0'::double precision) ORDER BY distance LIMIT 50
```
When I run this query, I am only getting 40 results returned. This happens for and LIMIT > 40. However when I go to >= 2575 I am getting the correct number returned. What is going on here, is this a bug?
I created the table with the following:
```SQL
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE TABLE IF NOT EXISTS vector_store (
id uuid DEFAULT uuid_generate_v4() PRIMARY KEY,
content text,
metadata json,
embedding vector(1536) // 1536 is the default embedding dimension
);
CREATE INDEX ON vector_store USING HNSW (embedding vector_cosine_ops);
```