广告
返回顶部
首页 > 资讯 > 数据库 >查看数据库表空间.md
  • 622
分享到

查看数据库表空间.md

2024-04-02 19:04:59 622人浏览 独家记忆
摘要

查看数据占用空间大小: SELECT CONCAT(ROUND(SUM(data_length)/(1024*1024*1024), 6), ' GB') AS 'Total Data Si

查看数据占用空间大小:

SELECT CONCAT(ROUND(SUM(data_length)/(1024*1024*1024), 6), ' GB') AS 'Total Data Size'  FROM infORMation_schema.TABLES WHERE table_schema LIKE 'quizzes';

查看指定数据库schema下的空间:

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 = 'quizzes';

SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name',  table_rows AS 'Number of Rows',  CONCAT(ROUND(data_length/(1024*1024*1024),6),' G') AS 'Data Size',  CONCAT(ROUND(index_length/(1024*1024*1024),6),' G') AS 'Index Size' ,  CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),6),' G') AS'Total' FROM information_schema.TABLES  WHERE table_schema LIKE 'aries_account' order by Total;

查看该实例下所有schema的空间:

select table_schema, sum(data_length+index_length)/1024/1024 as total_mb,   
sum(data_length)/1024/1024 as data_mb, sum(index_length)/1024/1024 as index_mb,   
count(*) as tables, curdate() as today from information_schema.tables group by table_schema order by 2 desc;

select concat(truncate(sum(data_length)/1024/1024,2),'MB') as data_size,  
concat(truncate(sum(max_data_length)/1024/1024,2),'MB') as max_data_size,   
concat(truncate(sum(data_free)/1024/1024,2),'MB') as data_free,  
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size 
 from information_schema.tables;
您可能感兴趣的文档:

--结束END--

本文标题: 查看数据库表空间.md

本文链接: https://www.lsjlt.com/news/51407.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作