当前位置:网站首页>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
边栏推荐
猜你喜欢

几行代码就可以把系统高崩溃;

C language file operation

如何正确理解线程机制中常见的I/O模型,各自主要用来解决什么问题?

Text-to-Image最新论文、代码汇总

Grammar Basics (Judgment Statements)

强化学习_03_表格方法实践(CartPole-v0 And MontoCarlo)

Reproduce dns out-band data combined with sqlmap

第11章 数据库的设计规范【2.索引及调优篇】【MySQL高级】
![[网络安全]实操AWVS靶场复现CSRF漏洞](/img/7f/f08e429e3d8ede03a1c1754e256f99.png)
[网络安全]实操AWVS靶场复现CSRF漏洞

Tencent Cloud Song Xiang: Kubernetes cluster utilization improvement practice
随机推荐
英国国家卫生服务遭受攻击,系统出现大面积故障
High quality WordPress download station 5 play theme template
2022 Henan Mengxin League Game (5): University of Information Engineering F - Split Turf
【愚公系列】2022年08月 Go教学课程 034-接口和多态
Bigder:42/100 showCase多少bug可以打回去
WooCommerce 安装和 rest api 使用
【Day10】进程管理命令
动态规划——从0-1背包问题到leetcode正则匹配
COLMAP+OpenMVS实现物体三维重建mesh模型
2022河南萌新联赛第(五)场:信息工程大学 C - 丢手绢
The constraints of the database learning table
CuteOneP 一款php的OneDrive多网盘挂载程序 带会员 同步等功能
修改 QtCreator 配置解决 “无法运行 rc.exe” 问题
initramfs与initrd的区别
Data types for database learning
Qt中输入框在Win10上“Win+/“快捷键的一个Bug
MySQL事务隔离级别
Text-to-Image最新论文、代码汇总
Win32屏幕坐标转换Qt坐标
个人实现的可任意折叠QToolBox——AdvancedToolBox