详解MySQL查看数据库表容量大小的方法总结

数据库 MySQL
今天主要介绍MySQL查看数据库表容量大小的几个方法,仅供参考。

[[276918]]

概述

今天主要介绍MySQL查看数据库表容量大小的几个方法,仅供参考。

1、查看所有数据库容量大小

  1. SELECT 
  2.     table_schema AS '数据库'
  3.     sum( table_rows ) AS '记录数'
  4.     sumTRUNCATE ( data_length / 1024 / 1024, 2 ) ) AS '数据容量(MB)'
  5.     sumTRUNCATE ( index_length / 1024 / 1024, 2 ) ) AS '索引容量(MB)'  
  6. FROM 
  7.     information_schema.TABLES  
  8. GROUP BY 
  9.     table_schema  
  10. ORDER BY 
  11.     sum( data_length ) DESC
  12.     sum( index_length ) DESC

详解MySQL查看数据库表容量大小的方法总结

2、查看所有数据库各表容量大小

  1. SELECT 
  2.     table_schema AS '数据库'
  3.     table_name AS '表名'
  4.     table_rows AS '记录数'
  5.     TRUNCATE ( data_length / 1024 / 1024, 2 ) AS '数据容量(MB)'
  6.     TRUNCATE ( index_length / 1024 / 1024, 2 ) AS '索引容量(MB)'  
  7. FROM 
  8.     information_schema.TABLES  
  9. ORDER BY 
  10.     data_length DESC
  11.     index_length DESC
详解MySQL查看数据库表容量大小的方法总结

3、查看指定数据库容量大小

  1. SELECT 
  2.     table_schema AS '数据库'
  3.     sum( table_rows ) AS '记录数'
  4.     sumTRUNCATE ( data_length / 1024 / 1024, 2 ) ) AS '数据容量(MB)'
  5.     sumTRUNCATE ( index_length / 1024 / 1024, 2 ) ) AS '索引容量(MB)'  
  6. FROM 
  7.     information_schema.TABLES  
  8. WHERE 
  9.     table_schema = 'mysql'
详解MySQL查看数据库表容量大小的方法总结

4、查看指定数据库各表容量大小

  1. SELECT 
  2.     table_schema AS '数据库'
  3.     table_name AS '表名'
  4.     table_rows AS '记录数'
  5.     TRUNCATE ( data_length / 1024 / 1024, 2 ) AS '数据容量(MB)'
  6.     TRUNCATE ( index_length / 1024 / 1024, 2 ) AS '索引容量(MB)'  
  7. FROM 
  8.     information_schema.TABLES  
  9. WHERE 
  10.     table_schema = 'mysql'  
  11. ORDER BY 
  12.     data_length DESC
  13.     index_length DESC
详解MySQL查看数据库表容量大小的方法总结

 


 

责任编辑:庞桂玉 来源: 今日头条
相关推荐

2019-09-17 08:23:35

MySQL数据库容量

2011-04-07 17:39:16

SQL Server数

2010-10-15 16:20:59

MySQL数据库表

2011-07-18 15:59:17

MySQL数据库

2017-09-27 09:36:22

数据库基础技巧数据库大小

2011-08-25 17:49:14

MySQLmysqlcheck

2010-11-16 11:17:41

Oracle表空间大小

2011-05-24 14:55:01

Oracle数据库

2010-04-14 13:14:46

Oracle数据库

2010-11-23 11:04:25

查看MySQL数据库

2010-10-13 11:54:00

MySQL数据库表

2011-04-12 14:48:38

MySQL数据库

2010-10-28 14:18:01

oracle数据库版本

2019-01-02 11:10:40

MySQL数据库数据库设计

2016-12-29 12:24:33

MySQL数据库移植

2011-08-05 14:31:04

mysql_conve批量转换MYSQL数据MYISAM

2010-09-08 16:03:57

SQL临时表数据库

2011-04-12 10:09:33

Oracle数据库关闭

2009-03-30 14:19:26

优化数据库MySQL

2019-07-11 08:45:00

MySQL数据库缓存
点赞
收藏

51CTO技术栈公众号