From: hlinnaka (@hlinnaka) <noreply+hlinnaka@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #434: Limit HNSW build's shared memory size for small tables
Date: Fri, 26 Jan 2024 17:02:44 +0000
Message-ID: <gh-pgvector-pgvector-434-c1912388089@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-434@github.com>
References: <gh-pgvector-pgvector-434@github.com>
BTW, did you consider using the `dsa.c` facility for the shared memory area? It's a pretty good fit for what we'd need, it can expand the shared memory area on the fly by managing a set of segments behind the scenes. And it has a DSA_ALLOC_NO_OOM flag, so back out gracefully if you run out of shared memory.
I suspect it's too slow for our purposes. You have to call dsa_get_address() to convert the relative pointer to a real pointer, and it has more overhead than the relptrs we use now. But maybe it's OK after all? I think the biggest problem in expanding the search is the cache misses, so that function call overhead might be hidden by the cache miss that you get anyway.