MEMORY_USAGE

The MEMORY_USAGE table describes the current memory usage of the current TiDB instance.

  1. USE information_schema;
  2. DESC memory_usage;
  1. +--------------------+-------------+------+------+---------+-------+
  2. | Field | Type | Null | Key | Default | Extra |
  3. +--------------------+-------------+------+------+---------+-------+
  4. | MEMORY_TOTAL | bigint(21) | NO | | NULL | |
  5. | MEMORY_LIMIT | bigint(21) | NO | | NULL | |
  6. | MEMORY_CURRENT | bigint(21) | NO | | NULL | |
  7. | MEMORY_MAX_USED | bigint(21) | NO | | NULL | |
  8. | CURRENT_OPS | varchar(50) | YES | | NULL | |
  9. | SESSION_KILL_LAST | datetime | YES | | NULL | |
  10. | SESSION_KILL_TOTAL | bigint(21) | NO | | NULL | |
  11. | GC_LAST | datetime | YES | | NULL | |
  12. | GC_TOTAL | bigint(21) | NO | | NULL | |
  13. | DISK_USAGE | bigint(21) | NO | | NULL | |
  14. | QUERY_FORCE_DISK | bigint(21) | NO | | NULL | |
  15. +--------------------+-------------+------+------+---------+-------+
  16. 11 rows in set (0.000 sec)
  1. SELECT * FROM information_schema.memory_usage;
  1. +--------------+--------------+----------------+-----------------+-------------+---------------------+--------------------+---------------------+----------+------------+------------------+
  2. | MEMORY_TOTAL | MEMORY_LIMIT | MEMORY_CURRENT | MEMORY_MAX_USED | CURRENT_OPS | SESSION_KILL_LAST | SESSION_KILL_TOTAL | GC_LAST | GC_TOTAL | DISK_USAGE | QUERY_FORCE_DISK |
  3. +--------------+--------------+----------------+-----------------+-------------+---------------------+--------------------+---------------------+----------+------------+------------------+
  4. | 33674170368 | 10737418240 | 5097644032 | 10826604544 | NULL | 2022-10-17 22:47:47 | 1 | 2022-10-17 22:47:47 | 20 | 0 | 0 |
  5. +--------------+--------------+----------------+-----------------+-------------+---------------------+--------------------+---------------------+----------+------------+------------------+
  6. 2 rows in set (0.002 sec)

The columns in the MEMORY_USAGE table are described as follows:

  • MEMORY_TOTAL: The total available memory of TiDB, in bytes.
  • MEMORY_LIMIT: The memory usage limit of TiDB, in bytes. The value is the same as that of the system variable tidb_server_memory_limit.
  • MEMORY_CURRENT: The current memory usage of TiDB, in bytes.
  • MEMORY_MAX_USED: The maximum memory usage of TiDB from the time it is started to the current time, in bytes.
  • CURRENT_OPS: “shrinking” | null. “shrinking” means that TiDB is performing operations that shrink memory usage.
  • SESSION_KILL_LAST: The timestamp of the last time a session is terminated.
  • SESSION_KILL_TOTAL: The number of times sessions are terminated, from the time TiDB is started to the current time.
  • GC_LAST: The timestamp of the last time Golang GC is triggered by memory usage.
  • GC_TOTAL: The number of times Golang GC is triggered by memory usage, from the time TiDB is started to the current time.
  • DISK_USAGE: The disk usage for the current data spill operation, in bytes.
  • QUERY_FORCE_DISK: The number of times data is spilled to disk, from the time TiDB is started to the current time.

See also