当前位置:网站首页>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编写
边栏推荐
- Qt列表下方增加弹出加载数据提示效果
- I would like to ask you guys, when FLink SQL reads the source, specify the time field of the watermark. If the specified field is in the grid
- About MongoDb query Decimal128 to BigDecimal problem
- 不同场景如何使用动态代理?
- 如何在VMlogin中设置YiLu代理?
- XV6 swtch.S详解
- 动态代理-cglib
- 程序员的十楼层。看看自己在第几层。PS:我的目标是:30岁第四层
- 共享静态IP与独享静态ip有何区别
- C language file operation
猜你喜欢
共享静态IP与独享静态ip有何区别
ACPI知识(高级配置和电源接口)
ES13 - ES2022 - The 123rd ECMA Congress approves the ECMAScript 2022 language specification
Mysql表数据在命令行窗口下中文乱码问题解决方法
腾讯云宋翔:Kubernetes集群利用率提升实践
软件测试面试题避雷(HR面试题)最常见的面试问题和技巧性答复
CuteOneP 一款php的OneDrive多网盘挂载程序 带会员 同步等功能
Chapter 11 Database Design Specifications [2. Index and Tuning] [MySQL Advanced]
修改 QtCreator 配置解决 “无法运行 rc.exe” 问题
COLMAP+OpenMVS realizes 3D reconstruction mesh model of objects
随机推荐
强化学习_10_Datawhale稀疏奖励
About MongoDb query Decimal128 to BigDecimal problem
强化学习_06_DataWhale深度Q网络
Qt使用私有接口绘制窗口阴影
2022河南萌新联赛第(五)场:信息工程大学 C - 丢手绢
关于Qt高频率信号槽合并的误解和方案
The constraints of the database learning table
老手也常误用!详解 Go channel 内存泄漏问题
如何正确理解线程机制中常见的I/O模型,各自主要用来解决什么问题?
Qt滚动条(QScrollBar)圆角样式问题跟踪
pthread编程重要知识点
排序二叉树代码
关于MongoDb查询Decimal128转BigDecimal问题
金融证券 初级 招股书 要求 黑话1刷数 黑话2底稿 黑话3董监高
基于ABP的AppUser对象扩展
Deep understanding of the array
MySQL事务隔离级别
Chapter 12 Other Database Tuning Strategies [2. Index and Tuning] [MySQL Advanced]
Grammar Basics (Judgment Statements)
力扣(LeetCode)221. 最大正方形(2022.08.09)