Oracle slow query

When I query my table in the same way as this one select * from mytable, sometimes (I query a table in a PLSQL developer or SQL navigator) the query quickly returns results, and sometimes it takes 25-26 seconds. Of course, this does not affect the execution of business transactions. I followed both conditions and gave the following results:

Fast time:

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
********************************************************************************

Slow time:

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
********************************************************************************
+4
source share
1 answer

For the first time he finds all the lines in the buffer cache (see section query), IO memory is faster than an IO disk.

query      
---------- 
0          
0         
169076     
-------  

QUERY

The total number of buffers received in consistent mode for all parsing, executing, or fetching sessions. Usually buffers are retrieved in consistent mode for requests

, , - , , Oracle (. disk), , IO. , , db file scattered read - , .

disk      
---------- 
0          
0         
169076     
------- 

DISK

, ,

+10

Source: https://habr.com/ru/post/1685842/


All Articles