SELECT CONCAT ROUND (SUM (index_length)/(1024*1024*1024), 2), ' GB ') as ' total index Size ' from INFORMATION_SCHEMA. TABLES WHERE table_schema like ' database ';
+------------------+
| Total Index Size |
+------------------+
| 1.70 GB |
+------------------+
(2) the Unit is MB
SELECT CONCAT ROUND (SUM (index_length)/(1024*1024), 2), ' MB ') as ' total index Size ' from INFORMATION_SCHEMA. TABLES WHERE table_schema like ' database ';
Where "database" is what you want to see
2. View table Space
SELECT CONCAT ROUND (SUM (data_length)/(1024*1024*1024), 2, ' GB ') as ' total data Size '
From INFORMATION_SCHEMA. TABLES WHERE table_schema like ' database ';
+-----------------+
| Total Data Size |
+-----------------+
| 3.01 GB |
+-----------------+
3. View information for all tables in the database
SELECT CONCAT (Table_schema, '. ', table_name) as ' table name ',
CONCAT (ROUND (table_rows/1000000,2), ' M ') as ' number of rows ',
CONCAT (ROUND (data_length/(1024*1024*1024), 2), ' G ') as ' data Size ',
CONCAT (ROUND (index_length/(1024*1024*1024), 2), ' G ') as ' Index Size ',
CONCAT (ROUND (data_length+index_length)/(1024*1024*1024), 2), ' G ') as ' total ' from INFORMATION_SCHEMA. TABLES WHERE table_schema like ' database ';
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.