当我像这样查询我的表时select * from mytable,有时(我查询PLSQL开发人员或SQL导航器中的表)查询会快速返回结果,有时需要25-26秒.当然,这不会影响业务交易的表现.我追踪了两种状态并给出了以下结果:
快速时间:
select *
from
mytable
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 0.64 1.14 0 169184 0 100
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.64 1.14 0 169184 0 100
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net more data to client 40 0.00 0.00
SQL*Net message from client 2 0.00 0.00
********************************************************************************
Run Code Online (Sandbox Code Playgroud)
慢时间:
select *
from
mytable
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 2.91 23.74 169076 169184 0 100
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 2.91 23.74 169076 169184 0 100
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
SQL*Net more data to client 40 0.00 0.00
SQL*Net message from client 2 0.00 0.00
db file scattered read **10686** 0.29 20.20
db file sequential read 6 0.00 0.01
latch: object queue header operation 1 0.00 0.00
********************************************************************************
Run Code Online (Sandbox Code Playgroud)
JSa*_*ota 10
在第一次,它找到缓冲区缓存中的所有行(请参阅query部分),内存IO比磁盘IO快.
query
----------
0
0
169076
-------
Run Code Online (Sandbox Code Playgroud)
QUERY
对于所有解析,执行或提取调用,以一致模式检索的缓冲区总数.通常,以一致模式检索缓冲区以进行查询
第二次,所需的行不再可用,可能由于某些其他查询所需的老化或空间而被刷新,因此Oracle进程必须从磁盘中提取所有行(请参阅disk下一节),这比内存IO慢.当然,db file scattered read由于查询中引用的表上缺少索引,查询第二次花费大部分时间.
disk
----------
0
0
169076
-------
Run Code Online (Sandbox Code Playgroud)
DISK
对于所有解析,执行或提取调用,从磁盘上的数据文件中物理读取的数据块总数
| 归档时间: |
|
| 查看次数: |
457 次 |
| 最近记录: |