This article introduces the command statements for checking the capacity of database tables in MySQL, and provides complete query statements and examples for easy learning and use. 1. View the capacity of all databases select table_schema as 'database', sum(table_rows) as 'Number of records', sum(truncate(data_length/1024/1024, 2)) as 'Data capacity (MB)', sum(truncate(index_length/1024/1024, 2)) as 'Index capacity (MB)' from information_schema.tables group by table_schema order by sum(data_length) desc, sum(index_length) desc; 2. View the capacity of all database tables select table_schema as 'database', table_name as 'table name', table_rows as 'number of records', truncate(data_length/1024/1024, 2) as 'Data capacity (MB)', truncate(index_length/1024/1024, 2) as 'Index capacity (MB)' from information_schema.tables order by data_length desc, index_length desc; 3. Check the capacity of the specified database Example: Check the capacity of the mysql database select table_schema as 'database', sum(table_rows) as 'Number of records', sum(truncate(data_length/1024/1024, 2)) as 'Data capacity (MB)', sum(truncate(index_length/1024/1024, 2)) as 'Index capacity (MB)' from information_schema.tables where table_schema='mysql'; 4. Check the capacity of each table in the specified database Example: Check the capacity of each table in the MySQL database select table_schema as 'database', table_name as 'table name', table_rows as 'number of records', truncate(data_length/1024/1024, 2) as 'Data capacity (MB)', truncate(index_length/1024/1024, 2) as 'Index capacity (MB)' from information_schema.tables where table_schema='mysql' order by data_length desc, index_length desc; The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Native js to achieve puzzle effect
Today I will take you through the history of ext4...
1. Download the pip installation package accordin...
The arrangement layout of aligning the two ends o...
Table of contents Achieve results Available plugi...
introduce Vue Router is the official routing mana...
After switching from Vue2's writing style to ...
Some people say that doing advertising is like bei...
<br />Recently, UCDChina wrote a series of a...
Zero, Background I received a lot of alerts this ...
This article example shares the specific code for...
Preface As we all know, JavaScript is single-thre...
Table of contents What is native JavaScript A. Ch...
1.17.9 More delicious, really Nginx download addr...
1. Pull the MySQL image Get the latest MySQL imag...