pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: ankane (@ankane) <noreply+ankane@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #781: index not used with cte
Date: Sat, 22 Feb 2025 18:27:57 +0000
Message-ID: <gh-pgvector-pgvector-781-c2676339746@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-781@github.com>
References: <gh-pgvector-pgvector-781@github.com>

As I mentioned earlier, there's not much pgvector can do if the planner isn't considering the index. You'll need to write the query in a way where the planner does consider it (or get this changed in the planner code).

```sql
EXPLAIN ANALYZE WITH vars AS (
    SELECT chunk_embedding AS qvt_embedding FROM dbpedia_14 WHERE chunk_index = 473679
)
SELECT a.title, (SELECT qvt_embedding FROM vars) <-> a.chunk_embedding AS l2distance
FROM dbpedia_14 a ORDER BY l2distance LIMIT 10;
```

view thread (11+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-781-c2676339746@github.com>
Permalink:  ../gh-pgvector-pgvector-781-c2676339746@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