如何统计表的活跃度?

本人花费半年的时间总结的《Java面试指南》已拿腾讯等大厂offer,已开源在github ,欢迎star!

本文GitHub https://github.com/OUYANGSIHAI/JavaInterview 已收录,这是我花了6个月总结的一线大厂Java面试总结,本人已拿大厂offer,欢迎star

原文链接:blog.ouyangsihai.cn >> 如何统计表的活跃度?

如何统计表的活跃度?

最近有朋友问了一个问题,

如何统计出表的活跃度?即统计出经常被访问使用的表。

我觉得有几种思路,

  1. 应用记录日志,可以根据需要,更精确地统计,满足各种定制化需求。

  2. 可以使用数据库审计功能,支持各种粒度的审计,但是会有些消耗,只要系统负责可以支持,算是一种比较科学的方法。

  3. DBA_HIST_SEG_STAT这张视图,可能有些帮助,记录了各种维度的统计数据。

DBA_HIST_SEG_STAT displays historical information about segment-level statistics. This view captures the top segments based on a set of criteria and captures information from V$SEGSTAT. The total value is the value of the statistics since instance startup. The delta value is the value of the statistics from the BEGIN_INTERVAL_TIME to the END_INTERVAL_TIME in the DBA_HIST_SNAPSHOT view.

  1. DBA/USER/ALL_TAB_MODIFICATION视图,作为Oracle统计信息,自动采集的依据,也可以间接了解,但可能比较粗,且数据不是实时刷新,

ALL_TAB_MODIFICATIONS describes tables accessible to the current user that have been modified since the last time statistics were gathered on the tables.

Note: These views are populated only for tables with the MONITORING attribute. They are intended for statistics collection over a long period of time. For performance reasons, the Oracle Database does not populate these views immediately when the actual modifications occur. Run the FLUSH_DATABASE_MONITORING_INFO procedure in the DBMS_STATS PL/SQL package to populate these views with the latest information. The ANALYZE_ANY system privilege is required to run this procedure.

视图中有INSERT、UPDATE、DELETE、TRUNCATED统计,

如何统计表的活跃度?

各位若有其他的想法、思路,可以提出来一起讨论。

如果您觉得本文有帮助,欢迎关注转发:bisal的个人杂货铺,

如何统计表的活跃度? 如何统计表的活跃度?
本人花费半年的时间总结的《Java面试指南》已拿腾讯等大厂offer,已开源在github ,欢迎star!

本文GitHub https://github.com/OUYANGSIHAI/JavaInterview 已收录,这是我花了6个月总结的一线大厂Java面试总结,本人已拿大厂offer,欢迎star

原文链接:blog.ouyangsihai.cn >> 如何统计表的活跃度?


 上一篇
EDB日期类型的一个问题 EDB日期类型的一个问题
最近有位同事问了一个,和EDB日期类型相关的问题,看起来很有意思,但实际和EDB原理有一些关系,使用客户端工具,创建新表,字段名称a,类型选择的是date, 保存完成,此时类型显示的则是timestamp,长度6,并不是
下一篇 
普通堆表在线转换为分区表 普通堆表在线转换为分区表
测试有一个需求,需要将一张普通堆表,转换为一张分区,用于测试分区表性能,之前曾经准备过环境,《》,但当时是重新加载数据,这次则是将已存在的表,进行这种分区转换操作,其实也可以利用导出导入,完成这一个需求,稍微有些饶了,但既然Ora