当前位置:网站首页>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
边栏推荐
猜你喜欢
裸辞—躺平—刷题—大厂(Android面试的几大技巧)
数据库学习之数据类型
CuteOneP is a PHP-based OneDrive multi-network disk mount program with member synchronization and other functions
DGIOT支持工业设备租赁以及远程管控
杭州公积金修改手机号信息
语法基础(判断语句)
MVCC详解
761. Special Binary Sequences
WooCommerce 安装和 rest api 使用
High quality WordPress download station 5 play theme template
随机推荐
调试ZYNQ的u-boot 2017.3 不能正常启动,记录调试过程
排序二叉树代码
Text-to-Image最新论文、代码汇总
MySQL之InnoDB引擎(六)
如何正确理解线程机制中常见的I/O模型,各自主要用来解决什么问题?
Data types for database learning
Excuse me.Oracle CDC connector supports LogMiner and XStream API two ways to capture
Confluence可以连接数据库但是在下一步就报错了
强化学习_03_表格方法实践(CartPole-v0 And MontoCarlo)
[网络安全]实操AWVS靶场复现CSRF漏洞
Qt滚动条(QScrollBar)圆角样式问题跟踪
Chapter 11 Database Design Specifications [2. Index and Tuning] [MySQL Advanced]
[Reinforcement Learning] "Easy RL" - Q-learning - CliffWalking (cliff walking) code interpretation
如何治理资源浪费?百度云原生成本优化最佳实践
Qt借助隐藏控件和QSS绘制重复元素
Regular backup of mysql database (retain backups for nearly 7 days)
761. Special Binary Sequences
强化学习_05_DataWhale近端策略优化
【电商业务】外行为何难区别 商品属性与商品规格
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