Query the SQL statement that all databases consume disk space size:
Copy the Code code as follows:
Select Table_schema, concat (Truncate (SUM (data_length)/1024/1024,2), ' MB ') as Data_size,
Concat (Truncate (SUM (index_length)/1024/1024,2), ' MB ') as Index_size
From Information_schema.tables
GROUP BY Table_schema
ORDER BY data_length Desc;
SQL statements that query the size of all table disks in a single library:
Copy the Code code as follows:
Select table_name, concat (Truncate (data_length/1024/1024,2), ' MB ') as Data_size,
Concat (Truncate (index_length/1024/1024,2), ' MB ') as Index_size
From information_schema.tables where Table_schema = ' TestDB '
GROUP BY TABLE_NAME
ORDER BY data_length Desc;
The above statement test is valid, pay attention to replace the above TestDB for the database name
Query data consumes disk size