当前位置:网站首页>SQL to check the disk usage of the database / table, kill the process and terminate the connection in tidb
SQL to check the disk usage of the database / table, kill the process and terminate the connection in tidb
2022-06-21 08:24:00 【Mr. Chang Ming】
Common grammar
1、 view the database / Table disk usage
-- Check the memory usage of the entire library :
select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
where TABLE_SCHEMA = 'tablename';
-- The memory occupation of the query table :
select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
where TABLE_NAME = 'tablesname';
TABLE_SCHEMA:The name of the schema to which the table belongs .TABLE_NAME:The name of the table .DATA_LENGTH:Data length .DATA_LENGTH= TABLE_ROWS * The sum of the storage lengths of the columns in a tuple . Not thinking about TiKV Copy of .INDEX_LENGTH:Index length .INDEX_LENGTH= TABLE_ROWS * The sum of the length of the columns in the index tuple . Not thinking about TiKV Copy of .
2、KILL TIDB Statement is used to terminate TiDB Connection in .
SHOW PROCESSLIST;
+------+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------+------+-----------+------+---------+------+-------+------------------+
| 1 | root | 127.0.0.1 | test | Query | 0 | 2 | SHOW PROCESSLIST |
| 2 | root | 127.0.0.1 | | Sleep | 4 | 2 | |
+------+------+-----------+------+---------+------+-------+------------------+
2 rows in set (0.00 sec)
KILL TIDB 2;
according to the design ,KILL TIDB Statement default and MySQL Are not compatible . The load balancer is usually followed by multiple TiDB The server , This default incompatibility helps prevent errors in TiDB Terminate connection on server .
mysql Usage method :
KILL [CONNECTION | QUERY] thread_id
边栏推荐
- Zhongyi Antu submitted for registration: proposed to raise 600million yuan, with annual revenue of nearly 1.2 billion yuan
- 8 methods of getting user ID in WordPress
- (thinking) C. differential sorting
- 利用注解改进代码检查
- Unity development related blog collection
- Represent each record in the dataframe as a dictionary
- Showctf starter file contains series
- About SQL: field association between two tables
- Cluster hui dsm7 add suite source
- 2022-2028 global after sales spark plug industry research and trend analysis report
猜你喜欢

Redis master-slave vulnerability and remote connection vulnerability

Eureka的TimedSupervisorTask类(自动调节间隔的周期性任务)

This article takes you to interpret the advertising advantages of tiktok

Decrypt FTP

Eureka's timedsupersortask class (periodic task with automatic interval adjustment)

2022-2028 global after sales spark plug industry research and trend analysis report

测试入门——软件测试模型

Mono fourni avec l'unit é 5 peut également supporter C # 6

2022-2028 global section valve industry research and trend analysis report

Blue Bridge Cup: Candy
随机推荐
antd table长表格如何出现滚动条
Global and Chinese market of filter microplate reader 2022-2028: Research Report on technology, participants, trends, market size and share
声临其境 — 音频沉浸体验
Using elastic stack to analyze Olympic data (II)
请问这些要求用mysql能实现吗
Joking Domain Driven Design (VI) -- Boundary context -- Design
Showctf web primer series
Give two strings S and T, and judge whether T is the word formed after rearrangement of S
LeetCode数组经典题目(一)
Unity .net 框架问题
Leedcode 1 - sum of two numbers
Introduction to testing - Software Test Model
Tsinghua University | van: visual attention network
Unity Detailed explanation of meta file function
Global and Chinese market of horizontal drilling rigs 2022-2028: Research Report on technology, participants, trends, market size and share
(thinking) C. differential sorting
window10局域网共享文件夹流程
【元宇宙3d大赛】
Global and Chinese market for online automatic optical inspection 2022-2028: Research Report on technology, participants, trends, market size and share
Post-Process初级使用笔记(重要的几项)