Reference
db.memory_report
Return the estimated resident memory of the database, per part, and its memory budget.
db.memory_report() -> dictParameters
Section titled “Parameters”None.
Returns
Section titled “Returns”dict with these keys:
| Key | Meaning |
|---|---|
mode |
Index mode in use, such as "flat" or "rabitq" |
bits |
RaBitQ bits per dimension, or None |
dimension |
Vector dimension |
count |
Stored records, deleted ones included |
vector_bytes |
Vectors or codes, as searches read them |
index_bytes |
Graph, rotation, codebooks, quantizer or centroids |
links_bytes |
Links between records (approximate) |
keyword_bytes |
Keyword index, if loaded (approximate) |
total_bytes |
Sum of the four parts above |
budget_bytes |
memory_mb in bytes, or None without a budget |
limit_bytes |
80 % of the budget, or None |
capacity |
Records the current mode holds within the limit, or None |
exact |
True when searches are exact (flat) |
Raises
Section titled “Raises”ValueError: the database is closed.
- These are estimates from the storage layouts, not readings from the operating system. See Memory budget.
- Thread safety: takes a shared lock, like
db.info.
Examples
Section titled “Examples”import srvdb
db = srvdb.create("./vectors", dimension=128, index="auto", memory_mb=50)db.add(["a"], [[1.0] + [0.0] * 127], ["{}"])report = db.memory_report()print(report["mode"], report["vector_bytes"])# flat 512See also
Section titled “See also”srvdb.create: thememory_mboption.- Fit a memory budget.
Was this page helpful? Tell us in Discussions.