# Server stats

Memgraph supports multiple queries to get information about the instance that is
being queried.

## Instance version

To get the version of the instance being queried, run the following query:

```cypher
SHOW VERSION;
```

The query can be run on data instances and on
[coordinators](https://memgraph.com/docs/clustering/high-availability), so you can check the version of
every instance in a high-availability cluster without connecting through the
MAIN. On data instances it requires the `STATS` privilege; on coordinators it is
a read-only query that requires
[`COORDINATOR_READ`](https://memgraph.com/docs/clustering/high-availability/coordinator-authentication#which-privilege-each-query-requires).

## Storage information

`SHOW STORAGE INFO` comes in two flavors:

- The unscoped `SHOW STORAGE INFO` query returns **instance-level** (process-wide)
  metrics only.
- The `ON DATABASE <name>` and `ON CURRENT DATABASE` variants return
  **per-database** metrics. See [Per-database storage information](#per-database-storage-information).

> **Warning**
>
> **Breaking change (Memgraph 3.11):** The unscoped `SHOW STORAGE INFO` no longer
> returns database-level metrics. Columns such as `name`, `database_uuid`,
> `vertex_count`, `edge_count`, `average_degree`, `unreleased_delta_objects`,
> `db_memory_tracked`, `db_storage_memory_tracked`, `db_embedding_memory_tracked`
> and `db_query_memory_tracked` are no longer part of its result set. Use
> `SHOW STORAGE INFO ON CURRENT DATABASE` (or `ON DATABASE <name>`) to obtain
> those per-database metrics.
>
> Several instance-level fields were also renamed:
>
> | Old name                          | New name                       |
> |-----------------------------------|--------------------------------|
> | `global_memory_tracked`           | `memory_tracked`               |
> | `global_runtime_allocation_limit` | `memory_limit`                 |
> | `global_license_allocation_limit` | `license_memory_limit`         |
> | `global_disk_usage`               | `disk_usage`                   |
> | `storage_mode`                    | `global_storage_mode`          |
>
> `global_isolation_level` keeps its name but its semantics changed: it now reports
> the startup-default isolation level (the [`--isolation-level`](https://memgraph.com/docs/database-management/configuration)
> flag) instead of the current database's runtime isolation level. The same applies
> to `global_storage_mode` (renamed from `storage_mode`), which now reflects the
> startup-default [`--storage-mode`](https://memgraph.com/docs/database-management/configuration). To observe
> runtime changes made via `SET GLOBAL TRANSACTION ISOLATION LEVEL` or
> `STORAGE MODE …`, query `SHOW STORAGE INFO ON CURRENT DATABASE` and read
> `storage_isolation_level` / `storage_mode`.

Running the following query returns instance-level (process-wide) information
about the storage of the current instance:

```cypher
SHOW STORAGE INFO;
```

The result contains the following fields, all scoped to the entire Memgraph
process (across all databases):

| Field                          | Description                                                                                                                                                                                                                                                                                          |
|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| vm_max_map_count               | The number of memory-mapped areas that the kernel allows a process to have. If it is unknown, returns -1.
For more info, check out the [virtual memory section](https://memgraph.com/docs/fundamentals/storage-memory-usage#virtual-memory).                                                                              |
| memory_res                     | The non-swapped physical RAM memory (RSS) used by the whole Memgraph process, as reported by the OS (in B, KiB, MiB, GiB or TiB).                                                                                                                                                                   |
| peak_memory_res                | Peak RAM memory (RSS) usage of the Memgraph process during the whole run.                                                                                                                                                                                                                           |
| disk_usage                     | The amount of disk space used by the data directory ([`--data-directory`](https://memgraph.com/docs/database-management/configuration), in B, KiB, MiB, GiB or TiB).                                                                                                                                                          |
| memory_tracked                 | The total amount of RAM allocated across the instance and tracked by Memgraph (in B, KiB, MiB, GiB or TiB).
For more info, check out [memory control](https://memgraph.com/docs/fundamentals/storage-memory-usage).                                                                                                       |
| memory_limit                   | The active instance-level runtime memory limit, taken from the [`--memory-limit`](https://memgraph.com/docs/database-management/configuration) flag (in B, KiB, MiB, GiB or TiB).                                                                                                                                             |
| license_memory_limit           | The memory limit imposed by the active license, or `"unlimited"` if no license is active. With an `enterprise` license this gates total tracked memory; with an `ai_platform` license it gates only graph and query memory. See [License types](https://memgraph.com/docs/database-management/enabling-memgraph-enterprise#license-types). |
| query+graph_memory_tracked     | The process-wide graph-arena tracked memory. Captures all default `new` allocations across the instance — both graph data and query-execution heap allocations.                                                                                                                                      |
| vector_index_memory_tracked    | The process-wide memory tracked for vector indices and embeddings across the instance.                                                                                                                                                                                                              |
| global_isolation_level         | The **startup-default** isolation level (the [`--isolation-level`](https://memgraph.com/docs/database-management/configuration) flag). It does **not** reflect runtime `SET GLOBAL TRANSACTION ISOLATION LEVEL` changes — read `storage_isolation_level` from the per-database variant for those.
For more info, check out [isolation levels](https://memgraph.com/docs/fundamentals/transactions#isolation-levels). |
| session_isolation_level        | The current `session` isolation level.                                                                                                                                                                                                                                                              |
| next_session_isolation_level   | The current `next` isolation level.                                                                                                                                                                                                                                                                 |
| global_storage_mode            | The **startup-default** storage mode (the [`--storage-mode`](https://memgraph.com/docs/database-management/configuration) flag). It does **not** reflect runtime `STORAGE MODE …` changes — read `storage_mode` from the per-database variant for those.
For more info, check out [storage modes](https://memgraph.com/docs/fundamentals/storage-memory-usage#storage-modes). |

### Per-database storage information

To get storage information for a specific database, use the `ON CURRENT DATABASE`
or `ON DATABASE <name>` variant. Both return the same per-database field set.

```cypher
SHOW STORAGE INFO ON CURRENT DATABASE;
```

`ON CURRENT DATABASE` targets the database the session is currently using.

```cypher
SHOW STORAGE INFO ON DATABASE mydb;
```

`ON DATABASE <name>` targets a named database. Accessing a **non-default**
database this way requires Memgraph Enterprise Edition; the default database is
available in all editions. Both variants require the `STATS` privilege.

For a [suspended (COLD)](https://memgraph.com/docs/database-management/multi-tenancy#suspending-and-resuming-databases-enterprise)
database this query still succeeds and returns the statistics captured at the
moment the database was suspended (its `state` field reads `COLD`). Fields that
only exist for a running database — `query_memory_tracked`,
`vector_index_memory_tracked` and `tenant_memory_tracked` — read `0 B`, and
`tenant_memory_limit` reads `unlimited`.

Process-wide fields such as `vm_max_map_count`, `memory_res`, `peak_memory_res`,
`memory_tracked` and the license/runtime memory limits are **not** included —
those are only available from the unscoped `SHOW STORAGE INFO`.

| Field                         | Description                                                                                                                                                  |
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name`                        | Name of the database the result refers to.                                                                                                                   |
| `state`                       | Whether the database is `HOT` (resident in memory) or `COLD` (suspended). See [suspending and resuming databases](https://memgraph.com/docs/database-management/multi-tenancy#suspending-and-resuming-databases-enterprise). |
| `database_uuid`               | Unique UUID of the database.                                                                                                                                 |
| `storage_mode`                | The storage mode of the database. See [storage modes](https://memgraph.com/docs/fundamentals/storage-memory-usage#storage-modes).                                                     |
| `vertex_count`                | Number of stored nodes (vertices).                                                                                                                           |
| `edge_count`                  | Number of stored relationships (edges).                                                                                                                      |
| `average_degree`              | Average number of relationships of a single node.                                                                                                            |
| `unreleased_delta_objects`    | Number of still-allocated Delta objects for this database.                                                                                                   |
| `disk_usage`                  | Disk space used by this database's portion of the data directory.                                                                                            |
| `graph_memory_tracked`        | Memory used by this database's graph structures (vertices, edges, properties).                                                                               |
| `query_memory_tracked`        | Memory used by this database's query execution.                                                                                                              |
| `vector_index_memory_tracked` | Memory used by this database's vector indices.                                                                                                               |
| `tenant_memory_tracked`       | Current tracked memory for the database (sum of the three memory fields above).                                                                              |
| `tenant_peak_memory_tracked`  | Peak memory tracked for the database.                                                                                                                        |
| `tenant_memory_limit`         | The memory limit set by the [tenant profile](https://memgraph.com/docs/database-management/tenant-profiles) attached to this database, or `"unlimited"` if no profile is attached.    |
| `storage_isolation_level`     | The isolation level used by this database's storage. See [isolation levels](https://memgraph.com/docs/fundamentals/transactions#isolation-levels).                                    |
| `health`                      | Database health: `ready`, or `broken` if durability recovery failed and the database came up empty (see [recovery failure handling](https://memgraph.com/docs/fundamentals/data-durability#recovery-failure-handling)). |

## Memory information <sup style={{ fontSize: '0.6em', color: '#888' }}>Enterprise</sup>

Running the following query returns per-database memory tracking information.
It requires the `STATS` privilege and is available only in Memgraph Enterprise Edition.

```cypher
SHOW MEMORY INFO;
```

The result contains these fields:

| Field                   | Description                                                     |
|-------------------------|-----------------------------------------------------------------|
| `name`                  | Database name                                                   |
| `tenant_memory_tracked` | Current tracked memory for the database in bytes                |
| `profile`               | Active tenant profile name, or `null` if none is attached       |
| `tenant_memory_limit`   | Configured memory limit (e.g. `"4096 MB"`), or `"unlimited"`   |

## License information

Running the following query will return information about the active Memgraph
Enterprise license (the winning license selected from all configured sources).

```cypher
SHOW LICENSE INFO;
```

| Field             | Description                                                                                          |
|-------------------|------------------------------------------------------------------------------------------------------|
| organization_name | Organization name for the enterprise license.                                                        |
| license_key       | Encoded license key.                                                                                 |
| is_valid          | Whether the license is currently valid. Uses the same validation logic as enterprise feature checks. |
| license_type      | `enterprise` / `ai_platform` / `oem` / `oem_community`                                                |
| valid_until       | Date when the license expires, or `FOREVER` for non-expiring licenses.                               |
| memory_limit      | The maximum tracked-memory value allowed by this license (in GiB), or `UNLIMITED` if the license sets no limit. When tracked memory reaches this limit, write queries are blocked. |
| status            | Descriptive status of the license validity.                                                          |
| memory_limit_policy | A human-readable description of how the license's `memory_limit` is enforced (see the table below). |

The value of `memory_limit_policy` depends on the `license_type` **and** whether
the license carries a non-zero `memory_limit`:

| License type                       | `memory_limit` | `memory_limit_policy`                                                            |
|------------------------------------|----------------|----------------------------------------------------------------------------------|
| `ai_platform`                      | `> 0`          | `"Graph and query memory are limited. Vector index memory is not limited."`      |
| `enterprise` / `oem` / other       | `> 0`          | `"All memory usage is limited."`                                                 |
| Any license type (incl. `ai_platform`) | `== 0`     | `"Memory usage is not limited."`                                                 |
| No / invalid license               | n/a            | `"Memory usage is not limited."`                                                 |

An `ai_platform` license with `memory_limit == 0` reports the unlimited string,
not the AI Platform policy string.

If no license has been provided, `is_valid` is `false` and `status` reads
`"You have not provided any license!"`.

## Metrics information

Running this query will show the system metrics for the current database,
combined with global metrics.  Same metrics can be provided from the HTTP
endpoint at default port 9091.  This is a query that only works with the
Memgraph Enterprise License. For the information about the metrics, please see
the [information about monitoring via HTTP
server](https://memgraph.com/docs/database-management/monitoring#metrics-tracking-via-http-server-enterprise-edition).

```cypher
SHOW METRICS INFO;
```

Users can also use the following query to get the same information:

```cypher
SHOW METRICS;
```

The output includes per-database metrics (scoped to the database you are
connected to) and global metrics (sessions, high availability). Histogram values
are reported in microseconds.

```copy=false
+------------------------------------------+---------------------+-------------+------------+
| name                                     | type                | metric type | value      |
+------------------------------------------+---------------------+-------------+------------+
| "ActiveExistenceConstraints"             | "Constraint"        | "Gauge"     | 0          |
| "ActiveTypeConstraints"                  | "Constraint"        | "Gauge"     | 0          |
| "ActiveUniqueConstraints"                | "Constraint"        | "Gauge"     | 0          |
| "AverageDegree"                          | "General"           | "Gauge"     | 41.2732    |
| "EdgeCount"                              | "General"           | "Gauge"     | 871978     |
| "VertexCount"                            | "General"           | "Gauge"     | 42254      |
| ...                                      | "HighAvailability"  | ...         | ...        |
| "ActiveEdgePropertyIndices"              | "Index"             | "Gauge"     | 0          |
| "ActiveEdgeTypeIndices"                  | "Index"             | "Gauge"     | 0          |
| "ActiveEdgeTypePropertyIndices"          | "Index"             | "Gauge"     | 0          |
| "ActiveLabelIndices"                     | "Index"             | "Gauge"     | 6          |
| "ActiveLabelPropertyIndices"             | "Index"             | "Gauge"     | 18         |
| "ActiveVertexPropertyIndices"            | "Index"             | "Gauge"     | 0          |
| "ActivePointIndices"                     | "Index"             | "Gauge"     | 0          |
| "ActiveTextIndices"                      | "Index"             | "Gauge"     | 0          |
| "ActiveTextEdgeIndices"                  | "Index"             | "Gauge"     | 0          |
| "ActiveVectorEdgeIndices"                | "Index"             | "Gauge"     | 0          |
| "ActiveVectorIndices"                    | "Index"             | "Gauge"     | 0          |
| "DbEmbeddingMemoryTracked"              | "Memory"            | "Gauge"     | 0          |
| "DbMemoryTracked"                        | "Memory"            | "Gauge"     | 81508835   |
| "DbPeakMemoryTracked"                    | "Memory"            | "Gauge"     | 81508835   |
| "DbQueryMemoryTracked"                   | "Memory"            | "Gauge"     | 0          |
| "DbStorageMemoryTracked"                 | "Memory"            | "Gauge"     | 81508835   |
| "DiskUsage"                              | "Memory"            | "Gauge"     | 81508835   |
| "MemoryRes"                              | "Memory"            | "Gauge"     | 339640320  |
| "PeakMemoryRes"                          | "Memory"            | "Gauge"     | 339775488  |
| "UnreleasedDeltaObjects"                 | "Memory"            | "Gauge"     | 0          |
| "GCLatency_us_50p"                       | "Memory"            | "Histogram" | 1000       |
| "GCLatency_us_90p"                       | "Memory"            | "Histogram" | 1000       |
| "GCLatency_us_99p"                       | "Memory"            | "Histogram" | 1000       |
| "GCSkiplistCleanupLatency_us_50p"        | "Memory"            | "Histogram" | 500        |
| "GCSkiplistCleanupLatency_us_90p"        | "Memory"            | "Histogram" | 500        |
| "GCSkiplistCleanupLatency_us_99p"        | "Memory"            | "Histogram" | 500        |
| "AccumulateOperator"                     | "Operator"          | "Counter"   | 0          |
| "AggregateOperator"                      | "Operator"          | "Counter"   | 0          |
| "ApplyOperator"                          | "Operator"          | "Counter"   | 0          |
| "CallProcedureOperator"                  | "Operator"          | "Counter"   | 0          |
| "CartesianOperator"                      | "Operator"          | "Counter"   | 0          |
| "ConstructNamedPathOperator"             | "Operator"          | "Counter"   | 0          |
| "CreateExpandOperator"                   | "Operator"          | "Counter"   | 0          |
| "CreateNodeOperator"                     | "Operator"          | "Counter"   | 0          |
| "DeleteOperator"                         | "Operator"          | "Counter"   | 0          |
| "DistinctOperator"                       | "Operator"          | "Counter"   | 0          |
| "EdgeUniquenessFilterOperator"           | "Operator"          | "Counter"   | 0          |
| "EmptyResultOperator"                    | "Operator"          | "Counter"   | 0          |
| "EvaluatePatternFilterOperator"          | "Operator"          | "Counter"   | 0          |
| "ExpandOperator"                         | "Operator"          | "Counter"   | 0          |
| "ExpandVariableOperator"                 | "Operator"          | "Counter"   | 0          |
| "FilterOperator"                         | "Operator"          | "Counter"   | 0          |
| "ForeachOperator"                        | "Operator"          | "Counter"   | 0          |
| "HashJoinOperator"                       | "Operator"          | "Counter"   | 0          |
| "IndexedJoinOperator"                    | "Operator"          | "Counter"   | 0          |
| "LimitOperator"                          | "Operator"          | "Counter"   | 0          |
| "MergeOperator"                          | "Operator"          | "Counter"   | 0          |
| "OnceOperator"                           | "Operator"          | "Counter"   | 0          |
| "OptionalOperator"                       | "Operator"          | "Counter"   | 0          |
| "OrderByOperator"                        | "Operator"          | "Counter"   | 0          |
| "PeriodicCommitOperator"                 | "Operator"          | "Counter"   | 0          |
| "PeriodicSubqueryOperator"               | "Operator"          | "Counter"   | 0          |
| "ProduceOperator"                        | "Operator"          | "Counter"   | 0          |
| "RemoveLabelsOperator"                   | "Operator"          | "Counter"   | 0          |
| "RemoveNestedPropertyOperator"           | "Operator"          | "Counter"   | 0          |
| "RemovePropertyOperator"                 | "Operator"          | "Counter"   | 0          |
| "RollUpApplyOperator"                    | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgeIdOperator"                | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgeOperator"                  | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgePropertyOperator"          | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgePropertyRangeOperator"     | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgePropertyValueOperator"     | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgeTypeOperator"              | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgeTypePropertyOperator"      | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgeTypePropertyRangeOperator" | "Operator"          | "Counter"   | 0          |
| "ScanAllByEdgeTypePropertyValueOperator" | "Operator"          | "Counter"   | 0          |
| "ScanAllByIdOperator"                    | "Operator"          | "Counter"   | 0          |
| "ScanAllByLabelOperator"                 | "Operator"          | "Counter"   | 0          |
| "ScanAllByLabelPropertiesOperator"       | "Operator"          | "Counter"   | 0          |
| "ScanAllByVertexPropertyOperator"        | "Operator"          | "Counter"   | 0          |
| "ScanAllByPointDistanceOperator"         | "Operator"          | "Counter"   | 0          |
| "ScanAllByPointWithinbboxOperator"       | "Operator"          | "Counter"   | 0          |
| "ScanAllOperator"                        | "Operator"          | "Counter"   | 0          |
| "SetLabelsOperator"                      | "Operator"          | "Counter"   | 0          |
| "SetNestedPropertyOperator"              | "Operator"          | "Counter"   | 0          |
| "SetPropertiesOperator"                  | "Operator"          | "Counter"   | 0          |
| "SetPropertyOperator"                    | "Operator"          | "Counter"   | 0          |
| "SkipOperator"                           | "Operator"          | "Counter"   | 0          |
| "UnionOperator"                          | "Operator"          | "Counter"   | 0          |
| "UnwindOperator"                         | "Operator"          | "Counter"   | 0          |
| "QueryExecutionLatency_us_50p"           | "Query"             | "Histogram" | 0          |
| "QueryExecutionLatency_us_90p"           | "Query"             | "Histogram" | 0          |
| "QueryExecutionLatency_us_99p"           | "Query"             | "Histogram" | 0          |
| "ReadQuery"                              | "QueryType"         | "Counter"   | 0          |
| "ReadWriteQuery"                         | "QueryType"         | "Counter"   | 0          |
| "WriteQuery"                             | "QueryType"         | "Counter"   | 0          |
| "ShowSchema"                             | "SchemaInfo"        | "Counter"   | 0          |
| "ActiveBoltSessions"                     | "Session"           | "Gauge"     | 1          |
| "ActiveSSLSessions"                      | "Session"           | "Gauge"     | 0          |
| "ActiveSessions"                         | "Session"           | "Gauge"     | 1          |
| "ActiveTCPSessions"                      | "Session"           | "Gauge"     | 1          |
| "ActiveWebSocketSessions"                | "Session"           | "Gauge"     | 0          |
| "BoltMessages"                           | "Session"           | "Counter"   | 4          |
| "SnapshotCreationLatency_us_50p"         | "Snapshot"          | "Histogram" | 0          |
| "SnapshotCreationLatency_us_90p"         | "Snapshot"          | "Histogram" | 0          |
| "SnapshotCreationLatency_us_99p"         | "Snapshot"          | "Histogram" | 0          |
| "SnapshotRecoveryLatency_us_50p"         | "Snapshot"          | "Histogram" | 10924534   |
| "SnapshotRecoveryLatency_us_90p"         | "Snapshot"          | "Histogram" | 10924534   |
| "SnapshotRecoveryLatency_us_99p"         | "Snapshot"          | "Histogram" | 10924534   |
| "ShowStorageInfo"                        | "StorageInfo"       | "Counter"   | 0          |
| "ShowStorageInfoOnDatabase"              | "StorageInfo"       | "Counter"   | 0          |
| "MessagesConsumed"                       | "Stream"            | "Counter"   | 0          |
| "StreamsCreated"                         | "Stream"            | "Counter"   | 0          |
| "DeletedEdges"                           | "TTL"               | "Counter"   | 0          |
| "DeletedNodes"                           | "TTL"               | "Counter"   | 0          |
| "ActiveTransactions"                     | "Transaction"       | "Gauge"     | 1          |
| "CommitedTransactions"                   | "Transaction"       | "Counter"   | 0          |
| "FailedPrepare"                          | "Transaction"       | "Counter"   | 0          |
| "FailedPull"                             | "Transaction"       | "Counter"   | 0          |
| "FailedQuery"                            | "Transaction"       | "Counter"   | 0          |
| "RolledBackTransactions"                 | "Transaction"       | "Counter"   | 0          |
| "SuccessfulQuery"                        | "Transaction"       | "Counter"   | 1          |
| "TransientErrors"                        | "Transaction"       | "Counter"   | 0          |
| "WriteWriteConflicts"                    | "Transaction"       | "Counter"   | 0          |
| "TriggersCreated"                        | "Trigger"           | "Counter"   | 0          |
| "TriggersExecuted"                       | "Trigger"           | "Counter"   | 0          |
+------------------------------------------+---------------------+-------------+------------+
```

## Build information

Running the following query will return certain information about the build type of
the current instance:

```cypher
SHOW BUILD INFO;
```

| Field      | Description                                         |
|------------|-----------------------------------------------------|
| build_type | The optimization level the instance was built with. |

## Active users information

Running this query will provide information about currently logged-in Memgraph users and their session details.

```cypher
SHOW ACTIVE USERS INFO;
```

Identical information can be obtained by executing the following command:

```cypher
SHOW ACTIVE USERS;
```

```copy=false
| username | session uuid                           | login timestamp       |
|----------|----------------------------------------|-----------------------|
| test     | "550e8400-e29b-41d4-a716-446655440000" | "2024-08-03 18:53:00" |
```
