forked from pingcap/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for global memory control (pingcap#10908)
- Loading branch information
Showing
7 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
information-schema/information-schema-memory-usage-ops-history.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: MEMORY_USAGE_OPS_HISTORY | ||
summary: Learn the `MEMORY_USAGE_OPS_HISTORY` information_schema system table. | ||
--- | ||
|
||
# MEMORY_USAGE_OPS_HISTORY | ||
|
||
The `MEMORY_USAGE_OPS_HISTORY` table describes the history of memory-related operations and the execution basis of the current TiDB instance. | ||
|
||
```sql | ||
USE information_schema; | ||
DESC memory_usage_ops_history; | ||
``` | ||
|
||
```sql | ||
+----------------+---------------------+------+------+---------+-------+ | ||
| Field | Type | Null | Key | Default | Extra | | ||
+----------------+---------------------+------+------+---------+-------+ | ||
| TIME | datetime | NO | | NULL | | | ||
| OPS | varchar(20) | NO | | NULL | | | ||
| MEMORY_LIMIT | bigint(21) | NO | | NULL | | | ||
| MEMORY_CURRENT | bigint(21) | NO | | NULL | | | ||
| PROCESSID | bigint(21) unsigned | YES | | NULL | | | ||
| MEM | bigint(21) unsigned | YES | | NULL | | | ||
| DISK | bigint(21) unsigned | YES | | NULL | | | ||
| CLIENT | varchar(64) | YES | | NULL | | | ||
| DB | varchar(64) | YES | | NULL | | | ||
| USER | varchar(16) | YES | | NULL | | | ||
| SQL_DIGEST | varchar(64) | YES | | NULL | | | ||
| SQL_TEXT | varchar(256) | YES | | NULL | | | ||
+----------------+---------------------+------+------+---------+-------+ | ||
12 rows in set (0.000 sec) | ||
``` | ||
|
||
{{< copyable "sql" >}} | ||
|
||
```sql | ||
SELECT * FROM information_schema.memory_usage_ops_history; | ||
``` | ||
|
||
```sql | ||
+---------------------+-------------+--------------+----------------+---------------------+------------+------+-----------------+------+------+------------------------------------------------------------------+----------------------------------------------------------------------+ | ||
| TIME | OPS | MEMORY_LIMIT | MEMORY_CURRENT | PROCESSID | MEM | DISK | CLIENT | DB | USER | SQL_DIGEST | SQL_TEXT | | ||
+---------------------+-------------+--------------+----------------+---------------------+------------+------+-----------------+------+------+------------------------------------------------------------------+----------------------------------------------------------------------+ | ||
| 2022-10-17 22:46:25 | SessionKill | 10737418240 | 10880237568 | 6718275530455515543 | 7905028235 | 0 | 127.0.0.1:34394 | test | root | 146b3d812852663a20635fbcf02be01688f52c8d433dafec0d496a14f0b59df6 | desc analyze select * from t t1 join t t2 on t1.a=t2.a order by t1.a | | ||
+---------------------+-------------+--------------+----------------+---------------------+------------+------+-----------------+------+------+------------------------------------------------------------------+----------------------------------------------------------------------+ | ||
2 rows in set (0.002 sec) | ||
``` | ||
|
||
The columns in the `MEMORY_USAGE_OPS_HISTORY` table are described as follows: | ||
|
||
* `TIME`: The timestamp when the session is terminated. | ||
* `OPS`: "SessionKill" | ||
* `MEMORY_LIMIT`: The memory usage limit of TiDB at the time of termination, in bytes. Its value is the same as that of the system variable `tidb_server_memory_limit`](/system-variables.md#tidb_server_memory_limit-new-in-v640). | ||
* `MEMORY_CURRENT`: The current memory usage of TiDB, in bytes. | ||
* `PROCESSID`: The connection ID of the terminated session. | ||
* `MEM`: The memory usage of the terminated session, in bytes. | ||
* `DISK`: The disk usage of the terminated session, in bytes. | ||
* `CLIENT`: The client connection address of the terminated session. | ||
* `DB`: The name of the database connected to the terminated session. | ||
* `USER`: The user name of the terminated session. | ||
* `SQL_DIGEST`: The digest of the SQL statement being executed in the terminated session. | ||
* `SQL_TEXT`: The SQL statement being executed in the terminated session. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: MEMORY_USAGE | ||
summary: Learn the `MEMORY_USAGE` information_schema system table. | ||
--- | ||
|
||
# MEMORY_USAGE | ||
|
||
The `MEMORY_USAGE` table describes the current memory usage of the current TiDB instance. | ||
|
||
```sql | ||
USE information_schema; | ||
DESC memory_usage; | ||
``` | ||
|
||
```sql | ||
+--------------------+-------------+------+------+---------+-------+ | ||
| Field | Type | Null | Key | Default | Extra | | ||
+--------------------+-------------+------+------+---------+-------+ | ||
| MEMORY_TOTAL | bigint(21) | NO | | NULL | | | ||
| MEMORY_LIMIT | bigint(21) | NO | | NULL | | | ||
| MEMORY_CURRENT | bigint(21) | NO | | NULL | | | ||
| MEMORY_MAX_USED | bigint(21) | NO | | NULL | | | ||
| CURRENT_OPS | varchar(50) | YES | | NULL | | | ||
| SESSION_KILL_LAST | datetime | YES | | NULL | | | ||
| SESSION_KILL_TOTAL | bigint(21) | NO | | NULL | | | ||
| GC_LAST | datetime | YES | | NULL | | | ||
| GC_TOTAL | bigint(21) | NO | | NULL | | | ||
| DISK_USAGE | bigint(21) | NO | | NULL | | | ||
| QUERY_FORCE_DISK | bigint(21) | NO | | NULL | | | ||
+--------------------+-------------+------+------+---------+-------+ | ||
11 rows in set (0.000 sec) | ||
``` | ||
|
||
{{< copyable "sql" >}} | ||
|
||
```sql | ||
SELECT * FROM information_schema.memory_usage; | ||
``` | ||
|
||
```sql | ||
+--------------+--------------+----------------+-----------------+-------------+---------------------+--------------------+---------------------+----------+------------+------------------+ | ||
| 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 | | ||
+--------------+--------------+----------------+-----------------+-------------+---------------------+--------------------+---------------------+----------+------------+------------------+ | ||
| 33674170368 | 10737418240 | 5097644032 | 10826604544 | NULL | 2022-10-17 22:47:47 | 1 | 2022-10-17 22:47:47 | 20 | 0 | 0 | | ||
+--------------+--------------+----------------+-----------------+-------------+---------------------+--------------------+---------------------+----------+------------+------------------+ | ||
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`](/system-variables.md#tidb_server_memory_limit-new-in-v640). | ||
* 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. |
Oops, something went wrong.