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

The method of checking Table size in mysql

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

Share

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

How to check the table size in mysql? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Mysql view table size method: 1, view the capacity size of each table in all databases, code is [truncate (data_length/1024/1024, 2) as' data capacity (MB)']; 2, view the capacity size of each table in the specified database.

How mysql looks at the size of the table:

1. View all database capacity sizes

Selecttable_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

Selecttable_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

Selecttable_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

Selecttable_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; thank you for reading! After reading the above, do you have a general idea of how to check the table size in mysql? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

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

Database

Wechat

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

12
Report