oracle 中查询记录数大于1000、进行过全表扫描、没有索引的表(性能优化)

执行前修改p.OBJECT_OWNER,注意都是大写字母

select table_name, num_rows
  from user_tables
 where table_name not in (select distinct table_name from user_indexes)
   and table_name not like '%_BAK'
   and table_name not like '%_BK'
   and num_rows > 1000
   and table_name in (SELECT distinct p.OBJECT_NAME
                        FROM v$sql_plan p
                       WHERE p.operation = 'TABLE ACCESS'
                         and p.OBJECT_OWNER = 'HR_GD'
                         AND p.options = 'FULL')
 order by num_rows desc 

你可能感兴趣的:(数据库,ORACLE)