mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-10 14:46:56 +08:00
Improved HNSW vacuum stats [skip ci]
This commit is contained in:
@@ -32,6 +32,7 @@ RemoveHeapTids(HnswVacuumState * vacuumstate)
|
|||||||
Relation index = vacuumstate->index;
|
Relation index = vacuumstate->index;
|
||||||
BufferAccessStrategy bas = vacuumstate->bas;
|
BufferAccessStrategy bas = vacuumstate->bas;
|
||||||
HnswElement entryPoint = HnswGetEntryPoint(vacuumstate->index);
|
HnswElement entryPoint = HnswGetEntryPoint(vacuumstate->index);
|
||||||
|
IndexBulkDeleteResult *stats = vacuumstate->stats;
|
||||||
|
|
||||||
/* Store separately since highestPoint.level is uint8 */
|
/* Store separately since highestPoint.level is uint8 */
|
||||||
int highestLevel = -1;
|
int highestLevel = -1;
|
||||||
@@ -77,11 +78,15 @@ RemoveHeapTids(HnswVacuumState * vacuumstate)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (vacuumstate->callback(&etup->heaptids[i], vacuumstate->callback_state))
|
if (vacuumstate->callback(&etup->heaptids[i], vacuumstate->callback_state))
|
||||||
|
{
|
||||||
itemUpdated = true;
|
itemUpdated = true;
|
||||||
|
stats->tuples_removed++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Move to front of list */
|
/* Move to front of list */
|
||||||
etup->heaptids[idx++] = etup->heaptids[i];
|
etup->heaptids[idx++] = etup->heaptids[i];
|
||||||
|
stats->num_index_tuples++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +382,6 @@ MarkDeleted(HnswVacuumState * vacuumstate)
|
|||||||
BlockNumber insertPage = InvalidBlockNumber;
|
BlockNumber insertPage = InvalidBlockNumber;
|
||||||
Relation index = vacuumstate->index;
|
Relation index = vacuumstate->index;
|
||||||
BufferAccessStrategy bas = vacuumstate->bas;
|
BufferAccessStrategy bas = vacuumstate->bas;
|
||||||
IndexBulkDeleteResult *stats = vacuumstate->stats;
|
|
||||||
|
|
||||||
while (BlockNumberIsValid(blkno))
|
while (BlockNumberIsValid(blkno))
|
||||||
{
|
{
|
||||||
@@ -431,13 +435,7 @@ MarkDeleted(HnswVacuumState * vacuumstate)
|
|||||||
|
|
||||||
/* Skip live tuples */
|
/* Skip live tuples */
|
||||||
if (ItemPointerIsValid(&etup->heaptids[0]))
|
if (ItemPointerIsValid(&etup->heaptids[0]))
|
||||||
{
|
|
||||||
stats->num_index_tuples++;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* Update stats */
|
|
||||||
stats->tuples_removed++;
|
|
||||||
|
|
||||||
/* Calculate sizes */
|
/* Calculate sizes */
|
||||||
etupSize = HNSW_ELEMENT_TUPLE_SIZE(etup->vec.dim);
|
etupSize = HNSW_ELEMENT_TUPLE_SIZE(etup->vec.dim);
|
||||||
|
|||||||
Reference in New Issue
Block a user