pgvector.git / summary / log / commit / refs
commit 02b01e1ca900386d7cb9deb59fc70e640c59d8c5
Author: Andrew Kane <andrew@ankane.org>
Date: Sun Oct 13 05:05:13 2024 +0000
Show tuples with memory usage [skip ci]
src/hnswscan.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/hnswscan.c b/src/hnswscan.c
index 84e23320..ba3dea86 100644
--- a/src/hnswscan.c
+++ b/src/hnswscan.c
@@ -102,6 +102,17 @@ GetScanValue(IndexScanDesc scan)
return value;
}
+#if defined(HNSW_MEMORY)
+/*
+ * Show memory usage
+ */
+static void
+ShowMemoryUsage(HnswScanOpaque so)
+{
+ elog(INFO, "memory: %zu KB, tuples: " INT64_FORMAT, MemoryContextMemAllocated(so->tmpCtx, false) / 1024, so->tuples);
+}
+#endif
+
/*
* Prepare for an index scan
*/
@@ -209,7 +220,7 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
so->first = false;
#if defined(HNSW_MEMORY)
- elog(INFO, "memory: %zu KB", MemoryContextMemAllocated(so->tmpCtx, false) / 1024);
+ ShowMemoryUsage(so);
#endif
}
@@ -271,7 +282,7 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir)
UnlockPage(scan->indexRelation, HNSW_SCAN_LOCK, ShareLock);
#if defined(HNSW_MEMORY)
- elog(INFO, "memory: %zu KB", MemoryContextMemAllocated(so->tmpCtx, false) / 1024);
+ ShowMemoryUsage(so);
#endif
}
[parent: 388e42f6e689]