Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explanation of the command statement for MySQL to view the capacity of database tables

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces MySQL to view the capacity of the database table command statement to explain, I hope you can add and update some knowledge, if there are other questions you need to know, you can continue to follow my updated article in the industry information.

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;2. View the table capacity of 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

This article explains how to view the capacity of database tables through MySQL. Please follow us for more information.

Related recommendations:

Explanation on the use of parsing strings into arrays by php str_getcsv

Optimize the client call server interface to reduce the request data capacity

Mysql order by rand () efficiency optimization method

These are the details of how to view the capacity of database tables through MySQL. For more information, please pay attention to other related articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report