pgvector / pgvector

Open-source vector similarity search for Postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there some doc to illustrate the storage layout in index file for HNSW ?

xingtanzjr opened this issue · comments

Hi,

Do you guys know where can I get the storage layout docs for HNSW in pgvector ? I want to know how the index file is organized and how the HNSW graph is stored in PG's index file. Is this similar to what this paper does ?
https://dl.acm.org/doi/pdf/10.1145/3318464.3386131

Thanks,
Jerry

Hi @xingtanzjr, the index alternates between element tuples and neighbor tuples - see the links for the exact layout of each. It places both tuples on the same page when possible to minimize the number of pages read during an index scan - see this function for more details.

Thank you @ankane