环境:hpux1123
10.2.0.1.0
发现问题如下:
SQL> connect open/tiananmen
Connected.
SQL> set autotrace on
SQL> set timing on
SQL> set autotrace traceonly
SQL> SELECT UserOrgPerm.FPermItemID FPERMITEMID FROM T_PM_UserOrgPerm USERORGPERM WHERE (UserOrgPerm.FOwner = '256c221a-0106-1000-e000-10d7c0a813f413B7DE7F' AND UserOrgPerm.FPermType = 10) UNION SELECT RolePerm.FPermItemID FPERMITEMID FROM T_PM_RolePerm ROLEPERM INNER JOIN T_PM_UserRoleOrg USERROLEORG ON UserRoleOrg.FRoleID = RolePerm.FRoleID WHERE (UserRoleOrg.FUserID = '256c221a-0106-1000-e000-10d7c0a813f413B7DE7F' AND RolePerm.FPermType = 10) UNION SELECT FID FPERMITEMID FROM T_PM_PermItem WHERE (FIsLeaf = 1 AND FType = 15);
4457 rows selected.
Elapsed: 00:00:38.04
Execution Plan
----------------------------------------------------------
--------------------------------------------------------------------------------
------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (
%CPU)|
--------------------------------------------------------------------------------
------
| 0 | SELECT STATEMENT | | 30M| 4364M| | 1017K
(100)|
| 1 | SORT UNIQUE | | 30M| 4364M| 9224M| 1017K
(100)|
| 2 | UNION-ALL | | | | |
|
| 3 | TABLE ACCESS FULL | T_PM_USERORGPERM | 13943 | 1252K| | 99
(2)|
| 4 | HASH JOIN | | 30M| 4362M| | 616
(55)|
| 5 | TABLE ACCESS FULL| T_PM_ROLEPERM | 20723 | 1618K| | 85
(2)|
| 6 | TABLE ACCESS FULL| T_PM_USERROLEORG | 34694 | 2439K| | 196
(2)|
| 7 | TABLE ACCESS FULL | T_PM_PERMITEM | 10 | 510 | | 71
(2)|
--------------------------------------------------------------------------------
------
Note
-----
- 'PLAN_TABLE' is old version
Statistics
----------------------------------------------------------
1 recursive calls
0 db block gets
2018 consistent gets
0 physical reads
0 redo size
260805 bytes sent via SQL*Net to client
3736 bytes received via SQL*Net from client
299 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
4457 rows processed
检查索引,发现有对于相应表的索引。不知道为什么还会出现全表扫描的情况呢?
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7652889/viewspace-627095/,如需转载,请注明出处,否则将追究法律责任。