How to view the size of the capacity of MySQL database tables
This article mainly introduces how to view the size of the MySQL database table capacity, the contents of the article are carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance is still relatively great, the following with the author to understand how to view the size of the MySQL database table capacity.
1. View all database capacity sizes
Select table_schema as' database', sum (table_rows) as' 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.tablesgroup by table_schemaorder by sum (data_length) desc, sum (index_length) desc
two。 View the capacity size of each table in all databases
Select table_schema as' database', table_name as' table name', table_rows as' records', truncate (data_length/1024/1024, 2) as' data capacity (MB)', truncate (index_length/1024/1024, 2) as' index capacity (MB) 'from information_schema.tablesorder by data_length desc, index_length desc
3. View the specified database capacity size
Example: check the capacity of the mysql library
Select table_schema as' database', sum (table_rows) as' 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.tableswhere table_schema='mysql'
4. View the capacity size of each table in the specified database
Example: check the capacity of each table in the mysql library
Select table_schema as' database', table_name as' table name', table_rows as' records', truncate (data_length/1024/1024, 2) as' data capacity (MB)', truncate (index_length/1024/1024, 2) as' index capacity (MB) 'from information_schema.tableswhere table_schema='mysql'order by data_length desc, index_length desc
After reading the above about how to view the capacity of MySQL database tables, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.