也许有很多种方法,这里只是书上学到的一种方法

with a as (
select grp_factor from (select distinct grp_factor from numbers where id < 10 order by grp_factor) t
where rownum <= 5) select b.id, a.grp_factor
from a cross apply(select id from (select id from numbers b where a.grp_factor = b.grp_factor order by id) t where rownum<=3)b --use v$sqlarea to find out your query by searching with key words. this might --take a little bit long.
select sql_id, sql_text from v$sqlarea where sql_text like '%cross apply%'; --copy the sql_id and place in the first place of parameters in the
--function "dbms_xplan.display_cursor" . in our case, it is 1gbpuv6zfq64s
select * from table(dbms_xplan.display_cursor('1gbpuv6zfq64s',null,'typical')); SQL_ID 1gbpuv6zfq64s, child number 0
-------------------------------------
with a as ( select grp_factor from (select distinct grp_factor from
numbers where id < 10 order by grp_factor) t where rownum <= 5)
select b.id, a.grp_factor from a cross apply(select id from (select id
from numbers b where a.grp_factor = b.grp_factor order by id) t where
rownum<=3)b Plan hash value: 3737636938 ------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
| 1 | NESTED LOOPS | | 1 | 26 | 2 (0)| 00:00:01 |
| 2 | VIEW | | 1 | 13 | 1 (0)| 00:00:01 |
|* 3 | COUNT STOPKEY | | | | | |
| 4 | VIEW | | 1 | 13 | 1 (0)| 00:00:01 |
|* 5 | SORT UNIQUE STOPKEY | | 1 | 26 | 1 (0)| 00:00:01 |
| 6 | TABLE ACCESS BY INDEX ROWID BATCHED| NUMBERS | 1 | 26 | 1 (0)| 00:00:01 |
|* 7 | INDEX RANGE SCAN | SYS_C009920 | 1 | | 1 (0)| 00:00:01 |
| 8 | VIEW | VW_LAT_A83890C2 | 1 | 13 | 1 (0)| 00:00:01 |
|* 9 | COUNT STOPKEY | | | | | |
| 10 | VIEW | | 1 | 13 | 1 (0)| 00:00:01 |
|* 11 | TABLE ACCESS BY INDEX ROWID | NUMBERS | 1 | 26 | 1 (0)| 00:00:01 |
| 12 | INDEX FULL SCAN | SYS_C009920 | 1 | | 1 (0)| 00:00:01 |
------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id):
--------------------------------------------------- 3 - filter(ROWNUM<=5)
5 - filter(ROWNUM<=5)
7 - access("ID"<10)
9 - filter(ROWNUM<=3)
11 - filter("A"."GRP_FACTOR"="B"."GRP_FACTOR") SQL_ID 1gbpuv6zfq64s, child number 1
-------------------------------------
with a as ( select grp_factor from (select distinct grp_factor from
numbers where id < 10 order by grp_factor) t where rownum <= 5)
select b.id, a.grp_factor from a cross apply(select id from (select id
from numbers b where a.grp_factor = b.grp_factor order by id) t where
rownum<=3)b Plan hash value: 3737636938 ------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------------------------------

Oracle ->> Oracle下查看实际执行计划的方法的更多相关文章

  1. Oracle之SQL优化专题02-稳固SQL执行计划的方法

    首先构建一个简单的测试用例来实际演示: create table emp as select * from scott.emp; create table dept as select * from ...

  2. Oracle之SQL优化专题01-查看SQL执行计划的方法

    在我2014年总结的"SQL Tuning 基础概述"中,其实已经介绍了一些查看SQL执行计划的方法,但是不够系统和全面,所以本次SQL优化专题,就首先要系统的介绍一下查看SQL执 ...

  3. Oracle查看SQL执行计划的方式

    Oracle查看SQL执行计划的方式     获取Oracle sql执行计划并查看执行计划,是掌握和判断数据库性能的基本技巧.下面案例介绍了多种查看sql执行计划的方式:   基本有以下几种方式: ...

  4. 如何查看MySQL执行计划

    在介绍怎么查看MySQL执行计划前,我们先来看个后面会提到的名词解释: 覆盖索引: MySQL可以利用索引返回select列表中的字段,而不必根据索引再次读取数据文件 包含所有满足查询需要的数据的索引 ...

  5. EXPLAIN 查看 SQL 执行计划

    EXPLAIN 查看 SQL 执行计划.分析索引的效率: id:id 列数字越大越先执行: 如果说数字一样大,那么就从上往下依次执行,id列为null的就表是这是一个结果集,不需要使用它来进行查询. ...

  6. 查看SQL执行计划

    一用户进入某界面慢得要死,查看SQL执行计划如下(具体SQL语句就不完全公布了,截断的如下): call     count       cpu    elapsed       disk       ...

  7. 查看Mysql执行计划

    使用navicat查看mysql执行计划: 打开profile分析工具: 查看是否生效:show variable like ‘%profil%’; 查看进程:show processlist; 选择 ...

  8. sql-查看执行计划的方法

    sql执行计划:把SQL语句拆分为每个的操作步骤组合,按照一定的顺序执行得出结果,查看并看懂执行计划是调优的关键步骤 查看执行计划的方法 DBMS_XPLAN包 sql*plus AUTO trace ...

  9. linux下查看某个文件位置的方法

    linux下查看某个文件位置的方法: 例如,不知道apache的配置文件httpd.conf的位置,可以有两种方法来查看: 1.find / -name httpd.conf2.locate http ...

随机推荐

  1. iptables端口转发

    iptables -t nat -A PREROUTING -d {外网ip}/32 -p tcp -m tcp --dport 4956 -j DNAT --to-destination 10.1. ...

  2. Netsharp快速入门(之4) 基础档案(之C 实体建模 计量单位、商品、往来单位)

    作者:秋时 杨昶   时间:2014-02-15  转载须说明出处 3.3.2   基础档案建模 1.在基础档案项目,右击,选择新建包, 2.录入包的名称,录入名称.完成后点确定 3.3.2.1 计量 ...

  3. Upgrading to Java 8——第三章 Optional and Similar Classes

    Java程序员对付空指针异常已经好多年了.在Java8中将有新的方式去处理他们.通过包装一个潜在的可能为null的类称为Optianal. 在Java8中添加了the Optional, Option ...

  4. 三级联动(ajax)

    <body> <div id="zhuti"></div> </body><script type="text/ja ...

  5. PF_PACKET在内核的流程

    PF_PACKET在内核的流程   套接字创建 packet_create() --> 赋值packet_ops   接收流程 packet_recvmsg() skb_recv_datagra ...

  6. EF异常:WebForm、Console、Winform层不引入EF报错

    WebForm.Console.Winform层可以不引入EntityFramework,但必须引入EntityFramework.SqlServer,否则运行时会报错

  7. SqlServer with递归查询的使用

    1.数据准备假定有一个表DiGui,有两个字段Id int ParentId intId ParentId4 05 07 02 18 515 59 714 1130 1523 1541 18104 2 ...

  8. ID3d11asynchronous

    http://msdn.microsoft.com/en-us/library/windows/desktop/ff476428(v=vs.85).aspx 这东西 该怎么用 ! 照这位兄弟的做就可以 ...

  9. uiview 单边圆角或者单边框

    UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(120, 10, 80, 80)]; view2.backgroundColor = ...

  10. 纯js页面跳转整理

    js方式的页面跳转1.window.location.href方式    <script language="javascript" type="text/java ...