Friday, November 18, 2011

All Full table scans in Database

Below Query will give Query text for which Full table scan occurs. This query will give result based on last 5 days.

select s.sql_text,db.operation,db.options,cpu_cost
  from dba_hist_sql_plan db ,dba_hist_sqltext s
      where  db.operation =  'TABLE ACCESS'
      and db.options = 'FULL'
      and s.sql_id = db.sql_id
      and db.object_owner = 'USER'
 --    order by db.timestamp desc
      and trunc(db.timestamp)  >= trunc(sysdate) -5
      order by cost desc;

No comments:

Post a Comment