当前位置:网站首页>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
边栏推荐
- Lunix(阿里云服务器)安装Anaconda并开启jupyter服务本地访问
- ESP32 485风速
- MySQL事务隔离级别
- 2022 Henan Mengxin League (fifth) game: University of Information Engineering H - Xiao Ming drinking milk tea
- mysql之两阶段提交
- A few lines of code can crash the system;
- Grammar Basics (Judgment Statements)
- 简单业务类
- The constraints of the database learning table
- 【Event Preview on August 9】Prometheus Summit
猜你喜欢

Confluence可以连接数据库但是在下一步就报错了
![Chapter 12 Other Database Tuning Strategies [2. Index and Tuning] [MySQL Advanced]](/img/6d/f7fffb327f3191ac4c5a3dc7808c89.png)
Chapter 12 Other Database Tuning Strategies [2. Index and Tuning] [MySQL Advanced]

【Day10】进程管理命令
![[Reinforcement Learning]](/img/14/27518d1fd3287487970c14c2489dfb.png)
[Reinforcement Learning] "Easy RL" - Q-learning - CliffWalking (cliff walking) code interpretation

3-6月面经总结,200多页真题笔记和详解(含核心考点及6家大厂)

关于MongoDb查询Decimal128转BigDecimal问题

Grammar Basics (Judgment Statements)

Nude speech - lying flat - brushing questions - big factory (several tips for Android interviews)

添加spark的相关依赖和打包插件(第六弹)

Qt滚动条(QScrollBar)圆角样式问题跟踪
随机推荐
大佬,oracle单表增量同步时候源库服务器额外占用内存近2g,这不正常吧
浅谈C语言实现冒泡排序
Qt绘制椭圆曲线的角度问题(离心角和旋转角)
Reproduce dns out-band data combined with sqlmap
语法基础(判断语句)
2022 Henan Mengxin League No. 5: University of Information Engineering B - Transportation Renovation
The constraints of the database learning table
Parallax Mapping: More Realistic Texture Detail Representation (Part 1): Why Use Parallax Mapping
强化学习_08_Datawhale针对连续动作的深度Q网络
S0:12345:respawn:/bin/start_getty 115200 ttyS0 vt102
3.事务篇【mysql高级】
DGIOT三千万电表集抄压测
强化学习_05_DataWhale近端策略优化
ESP32 485风速
【Event Preview on August 9】Prometheus Summit
第2章 变量和基本类型读书笔记
[网络安全]实操AWVS靶场复现CSRF漏洞
强化学习_11_Datawhale模仿学习
mysql数据库定时备份(保留近7天的备份)
H3C文档NAT专题