mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-12 15:46:54 +08:00
Improved code [skip ci]
This commit is contained in:
@@ -375,13 +375,14 @@ InsertTupleInMemory(Relation index, Datum *values, ItemPointer heaptid, HnswBuil
|
|||||||
/* Add to graph memory context */
|
/* Add to graph memory context */
|
||||||
oldCtx = MemoryContextSwitchTo(buildstate->graphCtx);
|
oldCtx = MemoryContextSwitchTo(buildstate->graphCtx);
|
||||||
|
|
||||||
if (dup != NULL)
|
if (dup == NULL)
|
||||||
|
buildstate->elements = lappend(buildstate->elements, element);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* No need to free element since memory unlikely to be reallocated */
|
/* No need to free element since memory unlikely to be reallocated */
|
||||||
|
/* Element is also used to estimate memory usage below */
|
||||||
HnswAddHeapTid(dup, heaptid);
|
HnswAddHeapTid(dup, heaptid);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
buildstate->elements = lappend(buildstate->elements, element);
|
|
||||||
|
|
||||||
MemoryContextSwitchTo(oldCtx);
|
MemoryContextSwitchTo(oldCtx);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user