mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-09 14:20:57 +08:00
Added check for MVCC-compliant snapshot for HNSW index scans - closes #281
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
## 0.5.1 (unreleased)
|
## 0.5.1 (unreleased)
|
||||||
|
|
||||||
|
- Added check for MVCC-compliant snapshot for HNSW index scans
|
||||||
- Improved performance of index scans for IVFFlat after updates and deletes
|
- Improved performance of index scans for IVFFlat after updates and deletes
|
||||||
|
|
||||||
## 0.5.0 (2023-08-28)
|
## 0.5.0 (2023-08-28)
|
||||||
|
|||||||
@@ -160,6 +160,11 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
|||||||
if (scan->orderByData == NULL)
|
if (scan->orderByData == NULL)
|
||||||
elog(ERROR, "cannot scan hnsw index without order");
|
elog(ERROR, "cannot scan hnsw index without order");
|
||||||
|
|
||||||
|
/* Requires MVCC-compliant snapshot as not able to maintain a pin */
|
||||||
|
/* https://www.postgresql.org/docs/current/index-locking.html */
|
||||||
|
if (!IsMVCCSnapshot(scan->xs_snapshot))
|
||||||
|
elog(ERROR, "non-MVCC snapshots are not supported with hnsw");
|
||||||
|
|
||||||
/* Get scan value */
|
/* Get scan value */
|
||||||
value = GetScanValue(scan);
|
value = GetScanValue(scan);
|
||||||
|
|
||||||
@@ -201,15 +206,6 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
|
|||||||
scan->xs_ctup.t_self = *heaptid;
|
scan->xs_ctup.t_self = *heaptid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Typically, an index scan must maintain a pin on the index page
|
|
||||||
* holding the item last returned by amgettuple. However, this is not
|
|
||||||
* needed with the current vacuum strategy, which ensures scans do not
|
|
||||||
* visit tuples in danger of being marked as deleted.
|
|
||||||
*
|
|
||||||
* https://www.postgresql.org/docs/current/index-locking.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
scan->xs_recheckorderby = false;
|
scan->xs_recheckorderby = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user