问题描述:Oracle通过主键id删除2000条记录很慢,需要花费十二分钟。解决过程:1.首先查看SQL的执行计划,执行计划正常,cost只有4,用到了主键索引。2.查看等待事件,select * from v$session_wait where sid = 507显示的event是db file sequential read,也没有异常。3.查看统计信息是否正常select * from user_tables where table_name = "";经检测,统计信息也是正常的。4.查看系统IO,也是正常的。5.找不到原因,开启SQL跟踪alter session set events="10046 trace name context forever,level 12";delete from t_table1 where id >= xxxalter session set events="10046 trace name context off";SQL跟踪得到一个trace文件tkprof orcl_ora_3708.trc myoutput.txtcat myoutput.txt,这次发现异常,文件里面除了有delete语句,还有两个select语句:select /*+ all_rows */ count(1) from "xxx"."T_TABLE2" where "FRESHMANID" = :1