- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
5#
发表于 2012-3-30 20:05:32
10053 TRACE :
Without "_windowfunc_optimization_settings"
SQL> oradebug setmypid
Statement processed.
SQL> oradebug event 10053 trace name context forever,level 1;
Statement processed.
SQL> alter system flush shared_pool;
System altered.
SQL> /
System altered.
SQL> select *
2 from (select id, row_number() over(order by t_date desc) r from t_rownum)
3 where r = 2;
ID R
---------- ----------
2 2
SQL> oradebug tracefile_name;
/s01/admin/G10R21/udump/g10r21_ora_3651.trc
******* UNPARSED QUERY IS *******
SELECT "T_ROWNUM"."ID" "ID",ROW_NUMBER() OVER ( ORDER BY "T_ROWNUM"."T_DATE" DESC ) "R" FROM "SYS"."T_ROWNUM" "T_ROWNUM"
kkoqbc-end
: call(in-use=22328, alloc=32712), compile(in-use=46536, alloc=48920)
kkoqbc-start
: call(in-use=22328, alloc=32712), compile(in-use=46624, alloc=48920)
****************
QUERY BLOCK TEXT
****************
select *
from (select id, row_number() over(order by t_date desc) r from t_rownum)
where r = 2
*********************
QUERY BLOCK SIGNATURE
*********************
qb name was generated
ignature (optimizer): qb_name=SEL$1 nbfros=1 flg=0
fro(0): flg=1 objn=0 hint_alias="from$_subquery$_001"@"SEL$1"
*****************************
SYSTEM STATISTICS INFORMATION
*****************************
Using NOWORKLOAD Stats
CPUSPEED: 714 millions instruction/sec
IOTFRSPEED: 4096 bytes per millisecond (default is 4096)
IOSEEKTIM: 10 milliseconds (default is 10)
***************************************
BASE STATISTICAL INFORMATION
***********************
Table Stats::
Table: from$_subquery$_001 Alias: from$_subquery$_001 (NOT ANALYZED)
#Rows: 0 #Blks: 0 AvgRowLen: 0.00
***************************************
OPTIMIZER STATISTICS AND COMPUTATIONS
***************************************
GENERAL PLANS
***************************************
Considering cardinality-based initial join order.
***********************
Join order[1]: from$_subquery$_001[from$_subquery$_001]#0
***********************
Best so far: Table#: 0 cost: 3.0009 card: 2.0000 bytes: 52
(newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:80000
*********************************
Number of join permutations tried: 1
*********************************
Final - All Rows Plan: Best join order: 1
Cost: 3.0009 Degree: 1 Card: 2.0000 Bytes: 52
Resc: 3.0009 Resc_io: 2.0000 Resc_cpu: 8575293
Resp: 3.0009 Resp_io: 2.0000 Resc_cpu: 8575293
kkoipt: Query block SEL$1 (#0)
******* UNPARSED QUERY IS *******
SELECT "from$_subquery$_001"."ID" "ID","from$_subquery$_001"."R" "R" FROM (SELECT "T_ROWNUM"."ID" "ID",ROW_NUMBER() OVER ( ORDER BY "T_ROWNUM"."T_DA
TE" DESC ) "R" FROM "SYS"."T_ROWNUM" "T_ROWNUM") "from$_subquery$_001" WHERE "from$_subquery$_001"."R"=2
kkoqbc-end
: call(in-use=39064, alloc=49080), compile(in-use=47128, alloc=48920)
apadrv-end: call(in-use=39064, alloc=49080), compile(in-use=48336, alloc=48920)
sql_id=8xf8wzffynch2.
Current SQL statement for this session:
select *
from (select id, row_number() over(order by t_date desc) r from t_rownum)
where r = 2
============
Plan Table
============
--------------------------------------------+-----------------------------------+
| Id | Operation | Name | Rows | Bytes | Cost | Time |
--------------------------------------------+-----------------------------------+
| 0 | SELECT STATEMENT | | | | 3 | |
| 1 | VIEW | | 2 | 52 | 3 | 00:00:01 |
| 2 | WINDOW SORT PUSHED RANK | | 2 | 44 | 3 | 00:00:01 |
| 3 | TABLE ACCESS FULL | T_ROWNUM| 2 | 44 | 2 | 00:00:01 |
--------------------------------------------+-----------------------------------+
Predicate Information:
----------------------
1 - filter("R"=2)
2 - filter(ROW_NUMBER() OVER ( ORDER BY INTERNAL_FUNCTION("T_DATE") DESC )<=2)
原SQL 变化为以下SQL:
SELECT "from$_subquery$_001"."ID" "ID","from$_subquery$_001"."R" "R" FROM (SELECT "T_ROWNUM"."ID" "ID",ROW_NUMBER() OVER ( ORDER BY "T_ROWNUM"."T_DA
TE" DESC ) "R" FROM "SYS"."T_ROWNUM" "T_ROWNUM") "from$_subquery$_001" WHERE "from$_subquery$_001"."R"=2
WINDOW SORT PUSHED RANK |
|