Important
The SingleStore 9.1 release candidate (RC) gives you the opportunity to preview, evaluate, and provide feedback on new and upcoming features prior to their general availability. In the interim, SingleStore 9.0 is recommended for production workloads, which can later be upgraded to SingleStore 9.1.
Identifying and Reducing Memory Usage
On this page
SingleStore keeps detailed accounting of how memory is being used.
Find memory usage with the MV_ information schema view or the SHOW STATUS EXTENDED command.
MV_ MEMORY_ USAGE
The MV_MV_ to monitor and identify the most significant memory consumers, including running processes, tables in memory, or internal data structures of running queries.
Introductory Example
This example shows how to use MV_ to break down and understand memory usage at a fine-grained level.
In MV_, groups and sub-groups provide a memory usage hierarchy.
Memory usages (ALLOC_s) with the same ID are disjoint and can be aggregated.
Note
Do not aggregate across different groups (different IDs).
The following query displays the total amount of memory used on node 1.GROUP_ indicates the ALLOC_ Total_, which displays total memory used by the server.
SELECT *FROM information_schema.MV_MEMORY_USAGEWHERE NODE_ID = 1AND GROUP_ID = 1;
*** 1. row ***
NODE_ID: 1
ALLOC_BYTES: 298188800
ALLOC_PROFILE: Total_server_memory
OWNER: {"SERVER":"MEMSQLD"}
OWNER_TYPE: SERVER
GROUP_ID: 1
SUBGROUP_IDS: {"subgroup_ids":[10]}
AGGREGATE_COUNT: 1To obtain a breakdown of the total memory used by the server (Total_), use the IDs from the SUBGROUP_ field.
The following query uses the predicate GROUP_, where 10 is from the SUBGROUP_ from the preceding query, to show memory usage for each of those subgroups.
The ORDER BY ALLOC_ clause sorts by memory usage to identify the top memory users.
SELECT *FROM information_schema.MV_MEMORY_USAGEWHERE NODE_ID = 1AND GROUP_ID = 10ORDER BY ALLOC_BYTES DESCLIMIT 3;
*** 1. row ***
NODE_ID: 1
ALLOC_BYTES: 159776768
ALLOC_PROFILE: Total_tracked_mmap_memory
OWNER: {"SERVER":"MEMSQLD"}
OWNER_TYPE: SERVER
GROUP_ID: 10
SUBGROUP_IDS: NULL
AGGREGATE_COUNT: 1
*** 2. row ***
NODE_ID: 1
ALLOC_BYTES: 69638456
ALLOC_PROFILE: Malloc_active_memory
OWNER: {"SERVER":"MEMSQLD"}
OWNER_TYPE: SERVER
GROUP_ID: 10
SUBGROUP_IDS: {"subgroup_ids":[500]}
AGGREGATE_COUNT: 1
*** 3. row ***
NODE_ID: 1
ALLOC_BYTES: 60948480
ALLOC_PROFILE: Buffer_manager_memory
OWNER: {"SERVER":"MEMSQLD"}
OWNER_TYPE: SERVER
GROUP_ID: 10
SUBGROUP_IDS: {"subgroup_ids":[200]}
AGGREGATE_COUNT: 1To break down memory used by Malloc_, query the subgroup of Malloc_, ID 500, using the following query.
SELECT *FROM information_schema.MV_MEMORY_USAGEWHERE NODE_ID = 1AND GROUP_ID = 500ORDER BY ALLOC_BYTES DESC;
To break down memory used by Buffer_, query the subgroup of Buffer_, ID 200, using the following query.
SELECT *FROM information_schema.MV_MEMORY_USAGEWHERE NODE_ID = 1AND GROUP_ID = 200ORDER BY ALLOC_BYTES DESC;
Important
It is acceptable to aggregate memory groups with the same ID.
Remarks
-
The value of
ALLOC_may be negative.BYTES A negative ALLOC_indicates the entity has freed memory that was allocated by other threads.BYTES A garbage collector is an example of an entity that frees memory allocated by other threads. -
Refer to MV_
MEMORY_ USAGE for additional information.
Groups
The following query lists the ALLOC_s and their group ID.
SELECT GROUP_CONCAT(DISTINCT ALLOC_PROFILE) AS AllocProfileList, GROUP_IDFROM information_schema.MV_MEMORY_USAGEGROUP BY GROUP_IDORDER BY GROUP_ID;
Examples
Example 1 - Find Total Memory Usage by Node
Find the total memory usage (Total_) of each node in a workspace using the following query.GROUP_ indicates Total_.
SELECT *FROM information_schema.MV_MEMORY_USAGEWHERE GROUP_ID = 1;
*** 1. row ***
NODE_ID: 1
ALLOC_BYTES: 219938816
ALLOC_PROFILE: Total_server_memory
OWNER: {"SERVER":"MEMSQLD"}
OWNER_TYPE: SERVER
GROUP_ID: 1
SUBGROUP_IDS: {"subgroup_ids":[10]}
AGGREGATE_COUNT: 1
*** 2. row ***
NODE_ID: 2
ALLOC_BYTES: 221380608
ALLOC_PROFILE: Total_server_memory
OWNER: {"SERVER":"MEMSQLD"}
OWNER_TYPE: SERVER
GROUP_ID: 1
SUBGROUP_IDS: {"subgroup_ids":[10]}
AGGREGATE_COUNT: 1
*** 3. row ***
NODE_ID: 3
ALLOC_BYTES: 221380608
ALLOC_PROFILE: Total_server_memory
OWNER: {"SERVER":"MEMSQLD"}
OWNER_TYPE: SERVER
GROUP_ID: 1
SUBGROUP_IDS: {"subgroup_ids":[10]}
AGGREGATE_COUNT: 1Example 2 - Find Top Types of Memory Usage by Node
Example 1 shows the total memory used by node.
In Example 1, group 10 is shown as the subgroup of group 1 (Total_).GROUP_) to show a breakdown of the results from Example 1.
SELECT *FROM information_schema.MV_MEMORY_USAGEWHERE GROUP_ID = 10ORDER BY NODE_ID, ALLOC_BYTES DESC;
+---------+-------------+---------------------------+----------------------+------------+----------+------------------------+-----------------+
| NODE_ID | ALLOC_BYTES | ALLOC_PROFILE | OWNER | OWNER_TYPE | GROUP_ID | SUBGROUP_IDS | AGGREGATE_COUNT |
+---------+-------------+---------------------------+----------------------+------------+----------+------------------------+-----------------+
| 1 | 177995776 | Total_tracked_mmap_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 1 | 27131904 | Buffer_manager_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | {"subgroup_ids":[200]} | 1 |
| 1 | 10069424 | Malloc_active_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | {"subgroup_ids":[500]} | 1 |
| 1 | 7340032 | Total_thread_stack_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 1 | 786432 | Total_io_pool_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 2 | 177340416 | Total_tracked_mmap_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 2 | 28049408 | Buffer_manager_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | {"subgroup_ids":[200]} | 1 |
| 2 | 8393952 | Malloc_active_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | {"subgroup_ids":[500]} | 1 |
| 2 | 8388608 | Total_thread_stack_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 2 | 786432 | Total_io_pool_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 3 | 177340416 | Total_tracked_mmap_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 3 | 28180480 | Buffer_manager_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | {"subgroup_ids":[200]} | 1 |
| 3 | 8388608 | Total_thread_stack_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
| 3 | 8366984 | Malloc_active_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | {"subgroup_ids":[500]} | 1 |
| 3 | 655360 | Total_io_pool_memory | {"SERVER":"MEMSQLD"} | SERVER | 10 | NULL | 1 |
+---------+-------------+---------------------------+----------------------+------------+----------+------------------------+-----------------+Example 3 - Find Memory Usage by Node Using Aggregation
The following query aggregates memory usage for all items with ID 10.
This query demonstrates aggregation within a group.
SELECT NODE_ID, SUM(ALLOC_BYTES)FROM information_schema.MV_MEMORY_USAGEWHERE GROUP_ID = 10GROUP BY NODE_ID;
+---------+------------------+
| node_id | sum(ALLOC_BYTES) |
+---------+------------------+
| 1 | 221360784 |
| 3 | 221528896 |
| 2 | 221949104 |
+---------+------------------+Example 4 - Find the User Tables Using the Most Memory
Find the top two user tables that use the most memory on a particular node, node 1 in this example.
SELECT *FROM information_schema.MV_MEMORY_USAGEWHERE NODE_ID = 1 AND OWNER_TYPE LIKE 'USER_TABLE'ORDER BY ALLOC_BYTES DESC LIMIT 2;
+---------+-------------+-------------------------+------------------------------------------+------------+----------+--------------+-----------------+
| NODE_ID | ALLOC_BYTES | ALLOC_PROFILE | OWNER | OWNER_TYPE | GROUP_ID | SUBGROUP_IDS | AGGREGATE_COUNT |
+---------+-------------+-------------------------+------------------------------------------+------------+----------+--------------+-----------------+
| 1 | 8519680 | Buffer_memory_for_table | {"DATABASE":"XDB_0","TABLE":"my_table2"} | USER_TABLE | 400 | NULL | 1 |
| 1 | 7208960 | Buffer_memory_for_table | {"DATABASE":"XDB_0","TABLE":"Xtab1"} | USER_TABLE | 400 | NULL | 1 |
+---------+-------------+-------------------------+------------------------------------------+------------+----------+--------------+-----------------+Example 5 - Find the Top Three Malloc Memory Users
Find the top three tasks or processes that are using the most Malloc memory on node 1.
SELECT NODE_ID, ALLOC_BYTES, OWNER
FROM information_schema.MV_MEMORY_USAGE
WHERE ALLOC_PROFILE LIKE 'Malloc'
AND NODE_ID = 1
ORDER BY ALLOC_BYTES DESC LIMIT 3;+---------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| NODE_ID | ALLOC_BYTES | OWNER |
+---------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1 | 161122592 | {"ACTIVITY":"memsqld_main","ACTIVITY_TRACKING_ID":null,"AGGREGATOR_ACTIVITY":"memsqld_main","DATABASE":null,"RAW_TASK":null,"THREAD_ID":1176552,"TYPE":"System"} |
| 1 | 17881984 | {"ACTIVITY":"Unclassified_malloc_total","ACTIVITY_TRACKING_ID":null,"AGGREGATOR_ACTIVITY":null,"DATABASE":null,"RAW_TASK":null,"THREAD_ID":-1,"TYPE":null} |
| 1 | 185888 | {"ACTIVITY":"ReplLogContainer::BottomlessUploadLogChunksThreadFn","ACTIVITY_TRACKING_ID":null,"AGGREGATOR_ACTIVITY":"ReplLogContainer::BottomlessUploadLogChunksThreadFn","DATABASE":null,"RAW_TASK":null,"THREAD_ID":1176585,"TYPE":"System"} |
+---------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+SHOW STATUS EXTENDED
The SHOW STATUS EXTENDED command displays a list of engine variable values as described in the following sections.
Summary variables
The following are summary variables that describe overall memory use:
-
Total_: Tracks the server’s overall memory use.server_ memory SingleStore does not let this value grow higher than maximum_.memory When Total_reachesserver_ memory maximum_, memory allocations start failing.memory Queries then fail with the error 1712 - "Not enough memory available to complete the current request.The request was not processed. " In addition, the trace log shows the following:
"Nonfatal buffer manager memory allocation failure.The maximum_ memory parameter (XXXXX MB) has been reached. " -
Alloc_: Tracks the memory stored inside of all rowstore tables (memory for rows, indexes, variable-length columns liketable_ memory VARCHARorJSONthat are stored off row).Once Alloc_reachestable_ memory maximum_,table_ memory INSERT,UPDATE, andLOAD DATAoperations against the tables receive the following error:1720 - "Memory usage by SingleStore for tables (XXXXX MB) has reached the value of 'maximum_table_ memory' global variable (YYYYY MB). This query cannot be executed. ". -
Buffer_: Tracks memory that is allocated by the Buffer Manager for SingleStore’s built-in memory allocators.manager_ memory The Buffer Manager is a component that consumes memory from the Linux OS in 128KB blocks and manages that memory out to memory allocators used by rowstore tables or by query execution. If the application makes heavy use of rowstore tables, it’s normal for Buffer_to be a large percentage ofmanager_ memory Total_.server_ memory -
Buffer_: Tracks memory that was allocated by the Buffer Manager, but is now cached and not in use.manager_ cached_ memory If the overall memory usage for SingleStore is much higher than the table memory usage, this cache may be the reason. Buffer_is capped at 25% ofmanager_ cached_ memory maximum_.memory SingleStore returns freed memory to Linux once Buffer_is at 25% ofmanager_ cached_ memory maximum_.memory For more information, see Configuring Memory Limits. -
Alloc_: Tracks memory allocated by currently executing queries for sorts, hash tables, result tables, etc.query_ execution If no queries are running, this value should be 0. -
Alloc_: Tracks memory allocated for variable-length columns inside rowstore tables, or for other variable-length memory allocations inside query execution (i.variable e. temporary allocations inside of string expressions, etc. ).
Row store variables
Row store has a set of allocators it uses for various part of an index.
-
Alloc_: Tracks memory used by the towers for skiplist indexes.skiplist_ towers Each skiplist index uses on average 40 bytes of memory per row using this allocator. The exact amount of memory per row is probabilistic. It depends on the randomized tower height of the particular row. -
Alloc_: Tracks memory used for on-row data for rowstore tables.table_ primary SingleStore tables share a single row memory allocation amongst all indexes on a particular table. Variable-length columns are not stored in this allocator ( VARCHAR,VARBINARY,BLOB,TEXT,JSON, etc).Instead, they are stored in Alloc_that was previously discussed in this topic.variable -
Alloc_: Tracks memory used to mark rows as deleted in rowstore tables.deleted_ version DELETEqueries in SingleStore don’t free up memory when they commit.They mark rows as deleted and the garbage collector frees this memory up when it is safe to do so (i. e. no query or operation is using the deleted row anymore). If this number is large, it means the garbage collector is behind or some operation is preventing the garbage collector from physically freeing the memory used by deleted rows. Examples of this could be a snapshot or a backup, or a long running query, etc. -
Alloc_: Tracks memory used for HASH index buckets (by default 4 million buckets per index, which would use 32 MB).hash_ buckets
Other variables
There are a few variables that describe memory used by components not directly related to running queries or storing data:
-
Alloc_: Tracks the amount of memory used during replication.replication -
Malloc_: Tracks memory allocated directly from the Linux OS and managed by the C runtime allocators (not SingleStore’s built-in memory allocators that use the Buffer Manager).active_ memory The memory use here should be approximately 1-2 GBs for most workloads. Column store tables, open connections, and memory for metadata about tables, columns, etc. are the biggest consumers of memory. -
Alloc_: Tracks memory used by thread stacks.thread_ stacks SingleStore caches threads used to run queries. Each thread has a 1 MB stack by default. This can be controlled by the thread_session variable, but SingleStore does not recommend changing this value.stack SingleStore kills threads it hasn’t used for 24 hours which frees up stack memory (this can be controlled by the idle_variable).thread_ lifetime_ seconds
In this section
Last modified: March 19, 2026