MySQL 实验室 因为专注,所以专业。

  • 首页
  • 博客
  • 下载
  • 文档
  • 工具
  • 知识库
  • 培训及服务
  • MySQL 5.1 Reference Manual :: 17 MySQL Cluster NDB 6.X/7.X :: 17.5 Management of MySQL Cluster :: 17.5.8 The ndbinfo MySQL Cluster Information Database :: 17.5.8.6 The ndbinfo memoryusage Table
    • MySQL 5.1 Reference Manual
    • Preface, Notes, Licenses
    • 1 General Information
    • 2 Installing and Upgrading MySQL
    • 3 Tutorial
    • 4 MySQL Programs
    • 5 MySQL Server Administration
    • 6 Backup and Recovery
    • 7 Optimization
    • 8 Language Structure
    • 9 Internationalization and Localization
    • 10 Data Types
    • 11 Functions and Operators
    • 12 SQL Statement Syntax
    • 13 Storage Engines
    • 14 High Availability and Scalability
    • 15 MySQL Enterprise Monitor
    • 16 Replication
    • 17 MySQL Cluster NDB 6.X/7.X
    • 18 Partitioning
    • 19 Stored Programs and Views
    • 20 INFORMATION_SCHEMA Tables
    • 21 Connectors and APIs
    • 22 Extending MySQL
    • A MySQL 5.1 Frequently Asked Questions
    • B Errors, Error Codes, and Common Problems
    • C MySQL Change History
    • D Restrictions and Limits
    • Index
    • Standard Index
    • C Function Index
    • Command Index
    • Function Index
    • INFORMATION_SCHEMA Index
    • Transaction Isolation Level Index
    • JOIN Types Index
    • Operator Index
    • Option Index
    • Privileges Index
    • SQL Modes Index
    • Status Variable Index
    • Statement/Syntax Index
    • System Variable Index

    17.5.8.6. The ndbinfo memoryusage Table

    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 in MySQL Cluster NDB 7.1.3 and later. 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 node ID of this data node.
    memory_type string One of DATA_MEMORY or INDEX_MEMORY.
    used integer Number of bytes currently used for data memory or index memory by this data node.
    used_pages integer Number of pages currently used for data memory or index memory by this data node; see text.
    total integer Total number of bytes of data memory or index memory available for this data node; see text.
    total_pages integer Total number of memory pages available for data memory or index memory on this data node; see text.

    The total column represents the total amount of memory in bytes available for the given resource (data memory or index memory) on a particular data node. This number should be approximately equal to the setting of the corresponding configuration parameter in the config.ini file.

    For the used_pages and total_pages columns, resources are measured in pages, which are 32K in size for DataMemory and 8K for IndexMemory.

    MySQL Cluster NDB 7.1.2 and earlier.  The the remainder of this section provides information about the memoryusage table as implemented prior to MySQL Cluster NDB 7.1.3. (If you are using MySQL Cluster NDB 7.1.3 or later, refer to the beginning of this section.) For each column, the table shown here provides 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 node 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 (in MySQL Cluster NDB 7.1.2 and earlier) are 16K in size for DataMemory and 8K for IndexMemory. This example shows how to use this information in obtaining totals for DataMemory, IndexMemory, or both, which you can do 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)