Get the App
SLTechnology News&Howtos  ›  Database  › 

Mysql database capacity query

Shulou Source: shulou.com Published: 2022-06-01 22:22:41 09月28日 Update

1. View all database capacity sizes Mysql "> 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 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 specified database capacity example: view mysql database size 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 of each table in a specified database example: view 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='smartmonitor'order by data_length desc, index_length desc

Tags: Capacity data database size index storage capacity query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft OPPO Reno MariaDB Docker