pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
7+ messages / 4 participants
[nested] [flat]

* [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
@ 2025-04-20 15:19  "Hannibal96 (@Hannibal96)" <noreply+Hannibal96@github.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Hannibal96 (@Hannibal96) @ 2025-04-20 15:19 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi 👋

I’d like to clarify the extent to which the HNSW index implementation in pgvector is fully ACID compliant, especially in the following areas:
1. If a transaction that inserts vectors is rolled back (either manually or due to a crash), will the HNSW index also roll back?

2. Does HNSW support deletions or in-place updates and is there any risk of index-table inconsistency?

3. During concurrent inserts and vector similarity queries, are there any scenarios where search queries might observe partially inserted or uncommitted vectors in the index?

4. What happens in the case of a crash after vector insertions but before the index is fully written to disk?

I’ve reviewed the docs and issues but couldn’t find a complete breakdown of how pgvector handles ACID properties specifically for the HNSW index. If there is any reliable source about it and you can share it will also be great!

Thanks,

^ permalink  raw  [nested|flat] 7+ messages in thread

* Re: [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
@ 2025-04-21 14:01  "jkatz (@jkatz)" <noreply+jkatz@github.com>
  5 siblings, 0 replies; 7+ messages in thread

From: jkatz (@jkatz) @ 2025-04-21 14:01 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@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.

^ permalink  raw  [nested|flat] 7+ messages in thread

* Re: [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
@ 2025-05-13 17:24  "mgoldey (@mgoldey)" <noreply+mgoldey@github.com>
  5 siblings, 0 replies; 7+ messages in thread

From: mgoldey (@mgoldey) @ 2025-05-13 17:24 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

If a row insertion is committed, should the row be immediately searchable after the transaction finishes or is there any expected latency?

^ permalink  raw  [nested|flat] 7+ messages in thread

* Re: [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
@ 2025-05-19 14:03  "jkatz (@jkatz)" <noreply+jkatz@github.com>
  5 siblings, 0 replies; 7+ messages in thread

From: jkatz (@jkatz) @ 2025-05-19 14:03 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

> If a row insertion is committed, should the row be immediately searchable after the transaction finishes

Yes. For more information on visibility, please see [transaction isolation](https://www.postgresql.org/docs/current/transaction-iso.html).

^ permalink  raw  [nested|flat] 7+ messages in thread

* Re: [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
@ 2025-05-20 13:42  "mgoldey (@mgoldey)" <noreply+mgoldey@github.com>
  5 siblings, 0 replies; 7+ messages in thread

From: mgoldey (@mgoldey) @ 2025-05-20 13:42 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Thank you for both unambiguously answering my question as well as linking to docs for further education.

^ permalink  raw  [nested|flat] 7+ messages in thread

* Re: [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
@ 2025-05-27 21:40  "ankane (@ankane)" <noreply+ankane@github.com>
  5 siblings, 0 replies; 7+ messages in thread

From: ankane (@ankane) @ 2025-05-27 21:40 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

One thing to add (to the initial question) is approximate results are not guaranteed to be the same between multiple executions of the same query (similar to phantom reads, but instead of differing based on visibility, it can differ based on the approximate search navigation).

^ permalink  raw  [nested|flat] 7+ messages in thread

* Re: [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates?
@ 2025-05-27 21:40  "ankane (@ankane)" <noreply+ankane@github.com>
  5 siblings, 0 replies; 7+ messages in thread

From: ankane (@ankane) @ 2025-05-27 21:40 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2025-05-27 21:40 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-20 15:19 [pgvector/pgvector] issue #824: Is the HNSW Index in pgvector Fully ACID Compliant, Including Under Crash Recovery and Concurrent Updates? "Hannibal96 (@Hannibal96)" <noreply+Hannibal96@github.com>
2025-04-21 14:01 ` "jkatz (@jkatz)" <noreply+jkatz@github.com>
2025-05-13 17:24 ` "mgoldey (@mgoldey)" <noreply+mgoldey@github.com>
2025-05-19 14:03 ` "jkatz (@jkatz)" <noreply+jkatz@github.com>
2025-05-20 13:42 ` "mgoldey (@mgoldey)" <noreply+mgoldey@github.com>
2025-05-27 21:40 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-05-27 21:40 ` "ankane (@ankane)" <noreply+ankane@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