How to Check the Memory Usage of a Running Session/Process in TiDB

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb某个正在运行的session/process占用的tidb内存多少怎么看

| username: zhanggame1

[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version] 7.1

[Encountered Problem: Problem Phenomenon and Impact]
How to check the memory usage of a specific running session/process in TiDB?
This session is performing data synchronization operations, so it executes a large number of insert operations. The dashboard shows that one TiDB node has high memory usage.

| username: TiDBer_vfJBUcxl | Original post link

You can check the memory usage of connections at TiDB 连接数占用内存计算(操作系统,summary) - AI牛丝

| username: zhanggame1 | Original post link

There seems to be an issue with your link.

| username: TiDBer_vfJBUcxl | Original post link

What is the issue?

| username: 啦啦啦啦啦 | Original post link

I remember that the INFORMATION_SCHEMA.CLUSTER_PROCESSLIST system table has it.

| username: zhanggame1 | Original post link

That is very small, it seems to be just the size of an SQL statement.

| username: 啦啦啦啦啦 | Original post link

Yes, it only shows the memory occupied by a single session and the memory used by the request being processed.

| username: redgame | Original post link

It should be what the expert mentioned, INFORMATION_SCHEMA.CLUSTER_PROCESSLIST.

| username: cassblanca | Original post link

Isn’t it this one? * Execute SELECT * FROM information_schema.processlist; to check the value of the MEM column corresponding to the SQL.

| username: wzf0072 | Original post link

If it is a slow query, you can locate it through TiDB Dashboard → Slow Queries: based on information such as SQL, TiDB instance, end run time, total execution time, etc., and check the memory usage.

| username: 江湖故人 | Original post link

Is the mem field accurate in the current version?