当前位置:网站首页>mysql数据库月增长量问题
mysql数据库月增长量问题
2022-08-10 06:29:00 【DBAjack】
如何统计出mysql数据库中的1个数据库月数据增长量?比如现在数据库是5G,查出上个月的数据库大小,然后相减得出月增长量
其他答案1:
这个如果没有历史的监控数据的话,mysql内部是记录不了的。
其他答案2:
写个监控脚本,每天du 一个数据目录。数据库本身没有记录数据增涨量
其他答案3:
可以粗略统计表或库级别数据量,两次收集,求差。
select table_schema, table_name, engine, table_type, sum(table_rows) as rows, round(sum(data_length)/1024/1024, 2) as `data(MB)`, round(sum(index_length)/1024/1024, 2) as `index(MB)`, round(sum(data_length+index_length)/1024/1024, 2) as `total_size(MB)`from information_schema.tableswhere table_schema not in ('mysql', 'information_schema', 'performance_schema', 'sys') and table_type not in('VIEW')group by table_schema, table_name, engine, table_typeorder by table_schema, table_name;
其他答案4:
如果有delete就不准了,当然如果你要个大概,也行
其他答案5:
- 对于单个实例,可以通过下面语句统计出该实例每个database的大小:
SELECT table_schema,SUM(AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH)/1024/1024 AS total_mb FROM information_schema.TABLES group by table_schema- 后面要做的,就是将当天/月的结果写入到库表里,比如写入dba_statistic.tmp_database_info:
insert into tmp_database_info (instance_id,business_ip,database_name,db_size,createdate)- 如果要统计多个实例,就需要通过自动化脚本,循环所有的实例,每个实例执行上面的select和insert操作
- 我们是写入clickhouse,脚本用python编写
边栏推荐
猜你喜欢

ebp/栈帧/call stack

ES13 - ES2022 - 第 123 届 ECMA 大会批准了 ECMAScript 2022 语言规范

BUUCTF Notes (web)
![[Reinforcement Learning]](/img/14/27518d1fd3287487970c14c2489dfb.png)
[Reinforcement Learning] "Easy RL" - Q-learning - CliffWalking (cliff walking) code interpretation

Reproduce dns out-band data combined with sqlmap

COLMAP+OpenMVS realizes 3D reconstruction mesh model of objects

【愚公系列】2022年08月 Go教学课程 034-接口和多态

不同场景如何使用动态代理?

761. Special Binary Sequences

Mysql表数据在命令行窗口下中文乱码问题解决方法
随机推荐
如何在VMlogin中设置YiLu代理?
OSPF的dr和bdr
ES13 - ES2022 - 第 123 届 ECMA 大会批准了 ECMAScript 2022 语言规范
C语言文件操作
杭州公积金修改手机号信息
Make a boot floppy and boot with bochs emulator
如何在AdsPower中设置YiLu代理?
The difference between initializing objects as null and empty objects in JS
3-6月面经总结,200多页真题笔记和详解(含核心考点及6家大厂)
Mysql表数据在命令行窗口下中文乱码问题解决方法
npm搭建私服,上传下载包
修改 QtCreator 配置解决 “无法运行 rc.exe” 问题
阿里巴巴(中国)网络技术有限公司、测试开发笔试二面试题(附答案)
Qt中输入框在Win10上“Win+/“快捷键的一个Bug
netlink IPC
MySQL笔记
强化学习_08_Datawhale针对连续动作的深度Q网络
vsnprint和snprintf的区别
Excuse me.Oracle CDC connector supports LogMiner and XStream API two ways to capture
CuteOneP 一款php的OneDrive多网盘挂载程序 带会员 同步等功能