wbl001

 

  有时候我们可能需要了解数据库中各个表的容量及大小,好了解数据库情况。

现只需要一条SQL就可以直观的展示出来。

 

SELECT
	table_schema AS \'数据库\',
	table_name AS \'表名\',
	table_rows AS \'记录数\',
	TRUNCATE (data_length / 1024 / 1024, 2) AS \'数据容量(MB)\',
	TRUNCATE (index_length / 1024 / 1024, 2) AS \'索引容量(MB)\'
FROM
	information_schema. TABLES
WHERE
	table_schema = \'dbname\' -- 数据库名字
ORDER BY
	table_rows DESC;

  

参考地址:https://www.cnblogs.com/rxbook/p/9168500.html

分类:

技术点:

相关文章:

  • 2021-11-29
  • 2021-11-17
  • 2021-11-29
  • 2021-08-24
  • 2021-11-16
  • 2021-08-14
  • 2021-11-29
猜你喜欢
  • 2021-11-29
  • 2021-11-26
  • 2021-11-29
  • 2021-12-09
  • 2021-08-24
  • 2021-08-14
相关资源
相似解决方案