pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: xcu (@xcu) <noreply+xcu@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #998: Allow index only scan in queries that require other table fields
Date: Fri, 10 Jul 2026 12:08:49 +0000
Message-ID: <gh-pgvector-pgvector-998@github.com> (raw)

From what I understand a query that needs something other than the distances (i.e 
`SELECT mytable.id, mytable.other_field, mytable.embedding <-> [embedding] LIMIT 10;`
) will be forced to go to disk because HNSW and IVF indexes only keep the TID for each row, so that forces Postgres to go to the heap and retrieve the associated values.

This can be problematic for big tables, because you already have a fairly big index in memory, so having to get the associated TID will likely result in  a higher memory footprint as you not only have to keep the HNSW/IVF index in memory, but also the actual table. This results in more disk reads and worse latency.

Is this something that you have in the roadmap? I'm not that knowledgeable about Postgres internals to understand what effort would be required. I suppose even keeping only the table PK in the index would be enough.

view thread (3+ messages)  latest in thread

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