当前位置:网站首页>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
边栏推荐
- VS Code插件国际化
- 修改 QtCreator 配置解决 “无法运行 rc.exe” 问题
- Parallax Mapping: More Realistic Texture Detail Representation (Part 1): Why Use Parallax Mapping
- Excuse me.Oracle CDC connector supports LogMiner and XStream API two ways to capture
- IDLE开发wordCount程序(第五弹)
- netlink IPC
- 深入理解LTE网络的CDRX
- 椭圆曲线离散对数问题以及求解
- H3C文档NAT专题
- BUUCTF笔记(web)
猜你喜欢
IDLE开发wordCount程序(第五弹)
英国国家卫生服务遭受攻击,系统出现大面积故障
DGIOT支持工业设备租赁以及远程管控
基于STC8G2K64S4单片机通过OLED屏幕显示模拟量光敏模拟值
深入理解数组
概率分布及其应用
Data types for database learning
CuteOneP is a PHP-based OneDrive multi-network disk mount program with member synchronization and other functions
WooCommerce 安装和 rest api 使用
3-6月面经总结,200多页真题笔记和详解(含核心考点及6家大厂)
随机推荐
MySQL事务隔离级别
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
tqdm高级使用方法(类keras进度条)
【论文解读】滴滴智能派单-KDD2018 Large-Scale Order Dispatch in On-Demand Ride-Hailing
求职
C language file operation
2022河南萌新联赛第(五)场:信息工程大学 B - 交通改造
941 · 滑动拼图
几行代码就可以把系统高崩溃;
3.1-3.3 读书笔记
May I ask why sqlserver cdc will report this error one day after the task is started, obviously cdc has been opened.
关于研究鼠标绘制平滑曲线的阶段总结
排序二叉树代码
浅谈C语言实现冒泡排序
强化学习_08_Datawhale针对连续动作的深度Q网络
Text-to-Image最新论文、代码汇总
【机器学习】神经网络中的优化器
Quickly grasp game resources in one hour and remote hot update
【无标题】
2022河南萌新联赛第(五)场:信息工程大学 K - 矩阵生成