Querying this table provides information similar to that
provided by the ALL REPORT MemoryUsage
command in the ndb_mgm client, or logged by
ALL DUMP 1000.
The following table provides information about the columns in
the memoryusage table. For each column, the
table shows the name, data type, and a brief description.
Additional information can be found in the notes following the
table.
| Column Name | Type | Remarks |
|---|---|---|
node_id |
integer | The ID of this data node. |
memory_type |
string | One of DATA_MEMORY or INDEX_MEMORY
|
used |
integer | Number of memory pages used; see text. |
max |
integer | Total number of memory pages available; see text. |
For the used and max
columns, resources are measured in pages, which are 16K in size
for DataMemory and 8K for
IndexMemory. The next example shows how to
use this information in obtaining totals for
DataMemory, IndexMemory,
or both. You can do this by summing across data nodes and table
columns, like this:
mysql>USE ndbinfo;Database changed mysql>SET @IPAGE := 8 * 1024;Query OK, 0 rows affected (0.03 sec) mysql>SET @DPAGE := 2 * @IPAGE;Query OK, 0 rows affected (0.00 sec) mysql>SELECT->@DPAGE * SUM(used) as 'Total DataMemory Used',->@DPAGE * SUM(max) as 'Total DataMemory Available',->@DPAGE * SUM(used) DIV COUNT(*) as 'Average DataMemory Used Per Node',->@DPAGE * SUM(max) DIV COUNT(*) as 'Average DataMemory Available Per Node'->FROM memoryusage WHERE memory_type = 'DATA_MEMORY'\G*************************** 1. row *************************** Total DataMemory Used: 106102784 Total DataMemory Available: 209977344 Average DataMemory Used Per Node: 53051392 Average DataMemory Available Per Node: 104988672 1 row in set (0.34 sec) mysql>SELECT->@IPAGE * SUM(used) as 'Total IndexMemory Used',->@IPAGE * SUM(max) as 'Total IndexMemory Available',->@IPAGE * SUM(used) DIV COUNT(*) as 'Average IndexMemory Used Per Node',->@IPAGE * SUM(max) DIV COUNT(*) as 'Average IndexMemory Available Per Node'->FROM memoryusage WHERE memory_type = 'INDEX_MEMORY'\G*************************** 1. row *************************** Total IndexMemory Used: 376832 Total IndexMemory Available: 210239488 Average IndexMemory Used Per Node: 188416 Average IndexMemory Available Per Node: 105119744 1 row in set (0.33 sec)
(We use DIV rather than /
in both queries so that the results in all of the output columns
are integers.)
Prior to MySQL Cluster NDB 7.1.2, the
memory_type column was named
DATA_MEMORY. (Bug#50926)

User Comments
Add your own comment.