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] issue #661: IVFFLAT QPS too low
Date: Mon, 26 Aug 2024 20:39:18 +0000
Message-ID: <gh-pgvector-pgvector-661-c2311047564@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-661@github.com>
References: <gh-pgvector-pgvector-661@github.com>

@bantmen A r5.2xlarge has 64GB of RAM, and if you're using the PostgreSQL defaults, this would mean 16GB is allocated for shared buffers.

An IVFFlat index for this dataset would be ~89GiB in size (excluding the size of the data in the table itself), so your entire index won't fit into memory. Additionally, the data access pattern for IVFFlat can be oversimplified as "random" - using your description above, out of 4,200 centers,  you're trying to find the 10 closest to a query vector. Amongst those centroids, you're looking at ~48K vectors, which is ~220MB of data. Given each query could lead to a complete different set of 10 out of the 4,200 centers, you could end up in a situation where you're swapping data in/out of memory fairly rapidly.

Could HNSW help? In this case, you're likely keeping the top layers of your graph in memory, and while the lower level may involve more fetches to disk, it's likely to be lower. For example, if you're using `hnsw.ef_search` on the default setting (40), you'll likely scan far fewer vectors (without seeing empirical data around your embedding model, I can't give an estimated convergence). I can't comment on if you'll meet your recall target without more information.

view thread (22+ messages)  latest in thread

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