
确实如 zjuzsf 所言.
********************************************************************************
采用view方式:
SQL ID : 4p0bncyf8011w
select count(*)
from
(select /*+result_cache*/ * from test)
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.01 0.08 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.01 6 7 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 0.01 0.10 6 7 0 2
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 89
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)
4 VIEW (cr=0 pr=0 pw=0 time=6 us cost=3 size=0 card=4)
4 RESULT CACHE 60bf29hyyjdw7a9wjc2gjng548 (cr=0 pr=0 pw=0 time=2 us)
0 TABLE ACCESS FULL TEST (cr=0 pr=0 pw=0 time=0 us cost=3 size=48 card=4)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 4 0.00 0.00
SQL*Net message from client 4 104.08 111.25
db file sequential read 1 0.01 0.01
db file scattered read 1 0.00 0.00
********************************************************************************
SQL ID : 0p971xjfhbjq6
select count(*)
from
(select /*+result_cache*/ * from test) where a='aaa'
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.01 0.01 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.00 0 0 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 0.01 0.01 0 0 0 2
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 89
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)
3 VIEW (cr=0 pr=0 pw=0 time=7 us cost=3 size=48 card=4)
4 RESULT CACHE 60bf29hyyjdw7a9wjc2gjng548 (cr=0 pr=0 pw=0 time=3 us)
0 TABLE ACCESS FULL TEST (cr=0 pr=0 pw=0 time=0 us cost=3 size=48 card=4)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 4 0.00 0.00
SQL*Net message from client 4 12.13 13.28
********************************************************************************
SQL ID : 39a6vq1mpq9fz
select count(*)
from
(select /*+result_cache*/ * from test) where a='aaa' and b='bbb'
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.01 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.00 0 0 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 0.00 0.01 0 0 0 2
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 89
Rows Row Source Operation
------- ---------------------------------------------------
1 SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)
2 VIEW (cr=0 pr=0 pw=0 time=6 us cost=3 size=96 card=4)
4 RESULT CACHE 60bf29hyyjdw7a9wjc2gjng548 (cr=0 pr=0 pw=0 time=2 us)
0 TABLE ACCESS FULL TEST (cr=0 pr=0 pw=0 time=0 us cost=3 size=48 card=4)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 4 0.00 0.00
SQL*Net message from client 4 51.82 53.76
********************************************************************************
SQL ID : 06nvwn223659v
alter session set events '10046 trace name context off'
非view方式:
TKPROF: Release 11.1.0.6.0 - Production on 星期日 12月 30 01:19:42 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Trace file: orcl_ora_2452.trc
Sort options: default
********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************
SQL ID : 3zjqbk5mpa14s
select /*+result_cache*/ count(*)
from
test
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.00 0 7 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 0.00 0.00 0 7 0 2
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 89
Rows Row Source Operation
------- ---------------------------------------------------
1 RESULT CACHE afysw5qk0jrfv1fqvy8ps394mx (cr=7 pr=0 pw=0 time=0 us)
1 SORT AGGREGATE (cr=7 pr=0 pw=0 time=0 us)
4 TABLE ACCESS FULL TEST (cr=7 pr=0 pw=0 time=2 us cost=3 size=0 card=4)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 5 0.00 0.00
SQL*Net message from client 5 21.08 34.28
********************************************************************************
SQL ID : 6ncyfa0f9urxu
select /*+result_cache*/ count(*)
from
test where a='aaa'
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.00 0 7 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 0.00 0.00 0 7 0 2
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 89
Rows Row Source Operation
------- ---------------------------------------------------
1 RESULT CACHE 4a53fwussbcp3ak24814b5nkjy (cr=0 pr=0 pw=0 time=0 us)
0 SORT AGGREGATE (cr=0 pr=0 pw=0 time=0 us)
0 TABLE ACCESS FULL TEST (cr=0 pr=0 pw=0 time=0 us cost=3 size=12 card=3)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 4 0.00 0.00
SQL*Net message from client 4 5.19 6.10
********************************************************************************
SQL ID : 4z6vtnz30cvpn
select /*+result_cache*/ count(*)
from
test where a='aaa' and b='bbb'
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.00 0 7 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 0.00 0.00 0 7 0 2
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 89
Rows Row Source Operation
------- ---------------------------------------------------
1 RESULT CACHE 8kr6s0nwjw9s415arfyrc12fmu (cr=7 pr=0 pw=0 time=0 us)
1 SORT AGGREGATE (cr=7 pr=0 pw=0 time=0 us)
2 TABLE ACCESS FULL TEST (cr=7 pr=0 pw=0 time=2 us cost=3 size=8 card=1)