当前位置:网站首页>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编写
边栏推荐
- 如何正确理解线程机制中常见的I/O模型,各自主要用来解决什么问题?
- order by injection and limit injection, and wide byte injection
- 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
- mysql之两阶段提交
- 【论文解读】滴滴智能派单-KDD2018 Large-Scale Order Dispatch in On-Demand Ride-Hailing
- [网络安全]实操AWVS靶场复现CSRF漏洞
- MySQL事务隔离级别
- 全网可达,实现备份
- Deep understanding of the array
- About MongoDb query Decimal128 to BigDecimal problem
猜你喜欢
随机推荐
pthread编程重要知识点
XV6 swtch.S详解
请问一下。Oracle CDC 连接器支持 LogMiner 和 XStream API 两种方式捕
vscode + ccls环境配置
ES13 - ES2022 - The 123rd ECMA Congress approves the ECMAScript 2022 language specification
BUUCTF Notes (web)
May I ask why sqlserver cdc will report this error one day after the task is started, obviously cdc has been opened.
QEMU guest与host通过网络通信——bridge/hostfwd/guestfwd
如何在AdsPower中设置YiLu代理?
CuteOneP 一款php的OneDrive多网盘挂载程序 带会员 同步等功能
mysql之两阶段提交
ESP32 485风速
修改 QtCreator 配置解决 “无法运行 rc.exe” 问题
强化学习_05_DataWhale近端策略优化
MVCC详解
2022 Henan Mengxin League Game (5): University of Information Engineering F - Split Turf
各位大佬 oracle cdc 默认配置 偶发会30秒才抓取到数据 这个怎么优化啊
Data types for database learning
MySQL's InnoDB engine (6)
A few lines of code can crash the system;