当前位置:网站首页>MySQL database monthly growth problem
MySQL database monthly growth problem
2022-08-10 06:50:00 【DBAjack】
How to count the monthly data growth of a database in a mysql database?For example, now the database is 5G, find out the database size of the previous month, and then subtract it to get the monthly growth
Other Answer 1:
If there is no historical monitoring data, MySQL cannot record it internally.
Other Answer 2:
Write a monitoring script, du a data directory every day.The database itself does not record data increments
Other Answer 3:
You can roughly count the amount of data at the table or library level, collect it twice, and calculate the difference.
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; Other Answer 4:
If there is a delete, it is not allowed, of course, if you want an overview, it is OK
Other Answer 5:
- For a single instance, the size of each database of the instance can be counted by the following statement:
SELECT table_schema,SUM(AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH)/1024/1024 AS total_mb FROM information_schema.TABLES group by table_schema- The next thing to do is to write the results of the current day/month into the database table, such as dba_statistic.tmp_database_info:
insert into tmp_database_info (instance_id,business_ip,database_name,db_size,createdate)- If you want to count multiple instances, you need to loop through all instances through an automated script, and each instance performs the above select and insert operations
- We write clickhouse, the script is written in python
边栏推荐
- 请问一下。Oracle CDC 连接器支持 LogMiner 和 XStream API 两种方式捕
- 强化学习_11_Datawhale模仿学习
- ctfshow SSTI 知识点总结
- Deep understanding of the array
- 各位大佬,oracle11g,cdc2.2,flink1.13.6,单表增量同步。在没新增数据的情
- Bigder:42/100 showCase多少bug可以打回去
- 【Event Preview on August 9】Prometheus Summit
- order by injection and limit injection, and wide byte injection
- Win32屏幕坐标转换Qt坐标
- 高质量WordPress下载站模板5play主题
猜你喜欢
随机推荐
语法基础(判断语句)
全网可达并设备加密
关于研究鼠标绘制平滑曲线的阶段总结
order by injection and limit injection, and wide byte injection
CuteOneP is a PHP-based OneDrive multi-network disk mount program with member synchronization and other functions
C language file operation
mysql数据库定时备份(保留近7天的备份)
DGIOT三千万电表集抄压测
DGIOT支持工业设备租赁以及远程管控
ctfshow SSTI 知识点总结
什么是MQTT网关?与传统DTU有哪些区别?
Everyone, the default configuration of oracle cdc occasionally takes 30 seconds to capture data. How to optimize this?
2022河南萌新联赛第(五)场:信息工程大学 K - 矩阵生成
ES13 - ES2022 - 第 123 届 ECMA 大会批准了 ECMAScript 2022 语言规范
2022河南萌新联赛第(五)场:信息工程大学 B - 交通改造
基于ABP的AppUser对象扩展
基于STC8G2K64S4单片机通过OLED屏幕显示模拟量光敏模拟值
[Network Security] Practice AWVS Range to reproduce CSRF vulnerability
2022 Henan Mengxin League No. 5: University of Information Engineering J-AC Automata
The difference between initializing objects as null and empty objects in JS









