From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
Date: Mon, 21 Apr 2025 14:01:22 +0000
Message-ID: <gh-pgvector-pgvector-824-c2818468161@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-824@github.com>
References: <gh-pgvector-pgvector-824@github.com>
These answers are specific to the pgvector implementation of HNSW for PostgreSQL.
> If a transaction that inserts vectors is rolled back (either manually or due to a crash), will the HNSW index also roll back?
Yes.
> Does HNSW support deletions or in-place updates and is there any risk of index-table inconsistency?
pgvector follows the same update semantics as PostgreSQL, i.e., the tuple being updated is removed and a new tuple is inserted.
> During concurrent inserts and vector similarity queries, are there any scenarios where search queries might observe partially inserted or uncommitted vectors in the index?
This is dependent on your [transaction isolation](https://www.postgresql.org/docs/current/transaction-iso.html) settings. The PostgreSQL default is `READ COMMITTED`, which disallows dirty reads.
> What happens in the case of a crash after vector insertions but before the index is fully written to disk?
The commit doesn't complete, and you have to retry the transaction.