Oracle Scripts

Most used or executed SQL Queries ( Last 20 )

Q: How can i see most used or executed SQL Queries ?

SELECT *
  FROM (  SELECT ss.sql_text,
                 a.SQL_ID,
                 SUM (CPU_TIME_DELTA),
                 SUM (DISK_READS_DELTA),
                 COUNT (*)
            FROM DBA_HIST_SQLSTAT a, dba_hist_snapshot s, v$sql ss
           WHERE     s.snap_id = a.snap_id
                 AND a.sql_id = ss.sql_id
                 AND s.begin_interval_time > SYSDATE - 1
        GROUP BY ss.sql_text, a.SQL_ID
        ORDER BY SUM (CPU_TIME_DELTA) DESC)
 WHERE ROWNUM <= 20;
Tags

Bugra Parlayan

I use this blog in my spare time to jot down thoughts and share my professional experiences. It’s my personal space to unwind and reflect. Feel free to share or reuse anything you find helpful here — just a small thank you is more than enough :) You can reach me at: bugra[@]bugraparlayan.com.tr

Related Articles

Leave a Reply

Back to top button
Close