Skip to content

Commit ae566d5

Browse files
authored
Merge pull request #171 from FalkorDB/danshalev7-patch-6
Update graph.memory.md
2 parents 6c4ec12 + 453a8c5 commit ae566d5

File tree

1 file changed

+45
-28
lines changed

1 file changed

+45
-28
lines changed

commands/graph.memory.md

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,61 @@
11
---
22
title: "GRAPH.MEMORY"
33
description: >
4-
The GRAPH.MEMORY command returns detailed memory usage statistics for the specified graph.
5-
This command can be used to monitor memory consumption at the graph level,
6-
providing insight into how much memory is used by various internal data structures such as
7-
nodes, edges, schemas, and indices.
8-
9-
This information is useful for debugging, monitoring, and optimizing graph workloads in FalkorDB deployments.
4+
The GRAPH.MEMORY USAGE command returns detailed memory usage statistics for the specified graph. This command provides insight into how much memory is used by various internal data structures such as nodes, edges, schemas, and indices. It enables users to analyze memory consumption at the graph level, reporting statistics in megabytes (MB). This is useful for debugging, monitoring, performance optimization, and capacity planning in FalkorDB deployments.
105
parent: "Commands"
116
---
127

138
# GRAPH.MEMORY
9+
The `GRAPH.MEMORY` command returns detailed memory consumption statistics for a specific graph in **megabytes (MB)**. It provides insight into how much memory is used by various internal data structures such as nodes, edges, schemas, indices, and matrix representations. This command can be used to monitor memory consumption at the graph level, making it especially useful for debugging, monitoring, performance optimization, and capacity planning in FalkorDB deployments.
1410

15-
The GRAPH.MEMORY command returns detailed memory usage statistics for the specified graph.
16-
This command can be used to monitor memory consumption at the graph level,
17-
providing insight into how much memory is used by various internal data structures such as
18-
nodes, edges, schemas, and indices.
11+
## Syntax
1912

20-
This information is useful for debugging, monitoring, and optimizing graph workloads in FalkorDB deployments.
13+
```bash
14+
GRAPH.MEMORY USAGE <graph-name> [SAMPLES <count>]
15+
```
2116

22-
The optional `SAMPLES` option can be provided, where count is the number of sampled graph entities.
23-
The samples are averaged to estimate the total size. By default, this option is set to 100.
17+
Usage: `GRAPH.MEMORY USAGE <graph_id> [SAMPLES <count>]`
2418

19+
## Arguments
2520

26-
Usage: `GRAPH.MEMORY USAGE <graph_id> [SAMPLES <count>]`
21+
| Argument | Description |
22+
|----------------|------------------------------------------------------------------------------------------------------------------------------------------|
23+
| `<graph-name>` | The name of the graph to inspect (also referred to as `<graph_id>`). |
24+
| `SAMPLES <n>` | *(Optional)* Number of samples to take when estimating memory usage. A higher number improves accuracy but increases computation time. The samples are averaged to estimate the total size. By default, this option is set to 100 if not specified. |
25+
26+
## Return
27+
28+
The command returns an array of key-value pairs, where each pair represents a specific memory metric and its value (in MB), corresponding to different components of the graph:
29+
30+
| Metric Name / Field | Type | Description |
31+
|-----------------------------------------------|---------|-------------------------------------------------------------------|
32+
| `total_graph_sz_mb` | integer | Total memory consumed by the graph. |
33+
| `label_matrices_sz_mb` | integer | Amount of memory used by label matrices (node labels tracking). |
34+
| `relation_matrices_sz_mb` | integer | Amount of memory used by relationship type matrices (graph topology tracking). |
35+
| `amortized_node_block_sz_mb` | integer | Memory used by nodes (amortized node storage). |
36+
| `amortized_node_storage_sz_mb` | integer | Amount of memory used for nodes storage (alternative naming). |
37+
| `amortized_node_attributes_by_label_sz_mb` | integer | Memory used by node attributes, split by node label. |
38+
| `amortized_unlabeled_nodes_attributes_sz_mb` | integer | Memory used by node attributes with no label. |
39+
| `amortized_edge_block_sz_mb` | integer | Memory used by edges (amortized edge storage). |
40+
| `amortized_edge_storage_sz_mb` | integer | Amount of memory used for relationships storage (alternative naming). |
41+
| `amortized_edge_attributes_by_type_sz_mb` | integer | Memory used by edge attributes, split by relationship type. |
42+
| `indices_sz_mb` | integer | Amount of memory consumed by indices (if any). |
43+
44+
*Note*: Metrics like `amortized_node_block_sz_mb` and `amortized_node_storage_sz_mb` are alternative names for the same data; both are included for clarity.
45+
46+
## Examples
2747

48+
### Basic Usage
49+
```bash
50+
GRAPH.MEMORY USAGE myGraph
51+
```
52+
53+
### With Sampling
54+
```bash
55+
GRAPH.MEMORY USAGE myGraph SAMPLES 500
56+
```
57+
58+
### Sample Output
2859
```sh
2960
127.0.0.1:6379> GRAPH.MEMORY USAGE flights
3061
1) "total_graph_sz_mb"
@@ -40,17 +71,3 @@ Usage: `GRAPH.MEMORY USAGE <graph_id> [SAMPLES <count>]`
4071
11) "indices_sz_mb"
4172
12) (integer) 752
4273
```
43-
44-
## Output
45-
46-
The command returns an array of key-value pairs, where each pair represents a specific memory metric and its value (in MB).
47-
48-
| Metric Name | Type | Description |
49-
|:-------------------------------|:--------|:---------------------------------------------------|
50-
| `total_graph_sz_mb` | integer | Total memory consumed by the graph. |
51-
| `label_matrices_sz_mb` | integer | Amount of memory used for node labels tracking. |
52-
| `relation_matrices_sz_mb` | integer | Amount of memory used for graph topology tracking. |
53-
| `amortized_node_storage_sz_mb` | integer | Amount of memory used for nodes storage. |
54-
| `amortized_edge_storage_sz_mb` | integer | Amount of memory used for relationships storage. |
55-
| `indices_sz_mb` | integer | Amount of memory consumed by indices. |
56-

0 commit comments

Comments
 (0)