• 查询TOP50 DML的表


    查询上一次统计信息收集以来到现在的DML次数,如果收集了统计信息了,那么就清空了.

    select *
      from (select *
              from (select *
                      from (select u.name owner,
                                   o.name table_name,
                                   null partition_name,
                                   null subpartition_name,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO') truncated,
                                   m.drop_segments
                              from sys.mon_mods_all$ m,
                                   sys.obj$          o,
                                   sys.tab$          t,
                                   sys.user$         u
                             where o.obj# = m.obj#
                               and o.obj# = t.obj#
                               and o.owner# = u.user#
                            union all
                            select u.name,
                                   o.name,
                                   o.subname,
                                   null,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods_all$ m, sys.obj$ o, sys.user$ u
                             where o.owner# = u.user#
                               and o.obj# = m.obj#
                               and o.type# = 19
                            union all
                            select u.name,
                                   o.name,
                                   o2.subname,
                                   o.subname,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods_all$ m,
                                   sys.obj$          o,
                                   sys.tabsubpart$   tsp,
                                   sys.obj$          o2,
                                   sys.user$         u
                             where o.obj# = m.obj#
                               and o.owner# = u.user#
                               and o.obj# = tsp.obj#
                               and o2.obj# = tsp.pobj#)
                     where owner not like '%SYS%'
                       and owner not like 'XDB'
                    union all
                    select *
                      from (select u.name owner,
                                   o.name table_name,
                                   null partition_name,
                                   null subpartition_name,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO') truncated,
                                   m.drop_segments
                              from sys.mon_mods$ m,
                                   sys.obj$      o,
                                   sys.tab$      t,
                                   sys.user$     u
                             where o.obj# = m.obj#
                               and o.obj# = t.obj#
                               and o.owner# = u.user#
                            union all
                            select u.name,
                                   o.name,
                                   o.subname,
                                   null,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods$ m, sys.obj$ o, sys.user$ u
                             where o.owner# = u.user#
                               and o.obj# = m.obj#
                               and o.type# = 19
                            union all
                            select u.name,
                                   o.name,
                                   o2.subname,
                                   o.subname,
                                   m.inserts,
                                   m.updates,
                                   m.deletes,
                                   m.timestamp,
                                   decode(bitand(m.flags, 1), 1, 'YES', 'NO'),
                                   m.drop_segments
                              from sys.mon_mods$   m,
                                   sys.obj$        o,
                                   sys.tabsubpart$ tsp,
                                   sys.obj$        o2,
                                   sys.user$       u
                             where o.obj# = m.obj#
                               and o.owner# = u.user#
                               and o.obj# = tsp.obj#
                               and o2.obj# = tsp.pobj#)
                     where owner not like '%SYS%'
                       and owner not like '%XDB%')
             order by inserts desc)
     where rownum <= 50;

    相关的索引,只有delete次数多,delete数据量大,才需要rebuild

  • 相关阅读:
    在asp.net项目中使用winform窗口
    href="#"是什么意思呢? (转)
    在asp.net webservice中如何使用session(转载)
    ASP.NET 2.0 新追加控件ImageMap介绍(转)
    SEO是什么?
    推荐60个jQuery插件(转)
    asp.net webform 与asp.net mvc 混合开发项目总结
    获取SqlDataReader的列名
    梯度下降法 Method of steepest descent.
    蒙特卡洛算法
  • 原文地址:https://www.cnblogs.com/nazeebodan/p/2782619.html
Copyright © 2020-2023  润新知