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
This article introduces a tutorial about how to u...
The use of ElementUI paging component Pagination ...
Table of contents 1. Introduction 2. Install Dock...
The command pattern is a behavioral design patter...
The code looks like this: .process{ border:1px so...
Problem Description I recently encountered a prob...
How to write transparent CSS for images using filt...
First, let’s look at the GIF operation: Case 1: S...
Assume that a node in the three-node MGR is abnor...
What is the purpose of this sentence? Copy code Th...
Preface: When we need to store decimals and have ...
Vue - implement the shuttle box function, the eff...
1. VMware download and install Link: https://www....
1. Demand A picture moves from left to right in a...
A common development need is that we want to coll...