首页
✨运维
🎉安装
👀踩坑
🤷‍♂️学习
😊关于
  • 分类
  • 标签
  • 归档
GitHub

Summer

运维界的小白
首页
✨运维
🎉安装
👀踩坑
🤷‍♂️学习
😊关于
  • 分类
  • 标签
  • 归档
GitHub
  • vim使用技巧

  • zabbix使用技巧

  • linux使用技巧

  • mysql使用技巧

    • 选择导出数据
    • mysql命令行导入sql
    • excel转换sql
    • mysql查看库大小
      • 1.查看所有数据库容量大小
      • 2.查看所有数据库各表容量大小
      • 3.查看demo库容量大小
      • 4.查看zabbix库中各表大小
    • oracle命令汇总
  • docker使用技巧

  • k8s使用技巧

  • redis使用技巧

  • elasticsearch使用技巧

  • window使用技巧

  • nginx使用技巧

  • 运维
  • mysql使用技巧
summer
2020-10-27

mysql查看库大小

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

select
table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables
group by table_schema
order by sum(data_length) desc, sum(index_length) desc;
1
2
3
4
5
6
7
8

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

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
order by data_length desc, index_length desc;
1
2
3
4
5
6
7
8

# 3.查看demo库容量大小

select
table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables
where table_schema='demo';
1
2
3
4
5
6
7

# 4.查看zabbix库中各表大小

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='zabbix'
order by data_length desc, index_length desc;
1
2
3
4
5
6
7
8
9
excel转换sql
oracle命令汇总

← excel转换sql oracle命令汇总→

最近更新
01
redis持久化
12-08
02
redis为什么这么快
12-08
03
redis的优缺点
12-08
更多文章>
Theme by Vdoing | Copyright © 2019-2020 Evan Xu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式