← Performance
Oracle · Performance

How to find top SQL by disk reads per execution in Oracle

Rank Oracle SQL from V$SQLAREA by disk reads per execution to surface heavy statements without needing AWR.

Tested on11g12c18c19c21c23ai26ai

V$SQLAREA is licence-free — every edition has it. This ranks SQL by disk reads per execution, which highlights heavy statements even when only one execution has run. Prompts for how many rows to return.

SELECT *
FROM (
  SELECT SUBSTR(a.sql_text, 1, 50) AS sql_text,
         TRUNC(a.disk_reads / DECODE(a.executions, 0, 1, a.executions)) AS reads_per_execution,
         a.buffer_gets,
         a.disk_reads,
         a.executions,
         a.sorts,
         a.address
  FROM   v$sqlarea a
  ORDER BY 2 DESC
)
WHERE rownum <= &&top_n;
performancev$sqlareadisk readsno license