Oracle専用だけど、重いSQLを取得するSQL。
SET LINES 1500;
SET LOBOF 1;
SET LONG 50000;
select sql_id,sql_fulltext,
elapsed_time/executions/1000000 "elapsed_time(sec)",
cpu_time/executions/1000000 "cpu_time(sec)",
rows_processed/executions "rows_processed(rows)",
buffer_gets/executions "buffer_gets(blocks)",
disk_reads/executions "disk_reads(blocks)",
sorts/executions "sorts(times)",
first_load_time, executions
from v$sqlarea
where executions != 0 and elapsed_time/executions > 3000000;