pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: knizhnik (@knizhnik) <noreply+knizhnik@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #282: Hnsw iterator
Date: Fri, 27 Sep 2024 06:07:02 +0000
Message-ID: <gh-pgvector-pgvector-282-c2378469598@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-282@github.com>
References: <gh-pgvector-pgvector-282@github.com>

> Hi @knizhnik,
> 
> For the first set of questions:
> 
> 1. Element versioning solves the first issue in my last comment
> 2. It's not possible to hold page locks for the duration of the scan for the iterative case (I believe there's an assertion that prevents it)
> 3. This would be extremely unlikely (the same element would also need to be deleted and replaced each time as well). That being said, I'll update the code so it doesn't crash if this ever happens. Edit: updated in [1a1221f](https://github.com/pgvector/pgvector/commit/1a1221f9051f4bb266846ce6af30b3aa4a93300d)
> 4. Inserts use `HNSW_UPDATE_LOCK` for synchronization.
> 
> For the second set of questions:
> 
> 1. It's fine if neighbors are updated during a scan.
> 2. Yes, as the comment in the code states: "Inserts before this point may have neighbors about to be deleted. Inserts after this point will not."
> 3. There are no issues with scans and inserts since neither delete elements.
> 
> Check out the comments in the code around `HNSW_UPDATE_LOCK` and `HNSW_SCAN_LOCK` for how it all works together.

O, I see...
Thank you very much for explanation.


view thread (33+ messages)  latest in thread

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