java社区活跃度_如何统计表的活跃度?

68bfdf3476ef0c6acd06a67b23f67ce1.gif

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

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

我觉得有几种思路,

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.

4. 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统计,

68bfdf3476ef0c6acd06a67b23f67ce1.gif

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

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

68bfdf3476ef0c6acd06a67b23f67ce1.gif

68bfdf3476ef0c6acd06a67b23f67ce1.gif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值