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

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. multiple backgrounds

    multiple backgrounds 多重背景,也就是CSS2里background的属性外加origin.clip和size组成的新background的多次叠加,缩写时为用逗号隔开的每组值:用 ...

  2. selenium IDE--录制和回放脚本

    1 selenium IDE--录制脚本 准备工作:firefox 浏览器安装了selenium IDE 插件 实例:打开百度搜索“软件测试” firefox浏览器打开网址:https://www.b ...

  3. Promises与Javascript异步编程

    Promises与Javascript异步编程 转载:http://www.zawaliang.com/2013/08/399.html 在如今都追求用户体验的时代,Ajax应用真的是无所不在.加上这 ...

  4. poj 2449 Remmarguts' Date K短路+A*

    题目链接:http://poj.org/problem?id=2449 "Good man never makes girls wait or breaks an appointment!& ...

  5. UVA 10078 The Art Gallery

    Problem: Century Arts has hundreds of art galleries scattered all around the country and you are hir ...

  6. 【BZOJ】【1053】【HAOI2007】反素数ant

    搜索 经典搜索题目(其实是蒟蒻只会搜……vfleaking好像有更优秀的做法?) 枚举质数的幂,其实深度没多大……因为$2^32$就超过N了……而且质数不能取的太大,所以不会爆…… /******** ...

  7. Matlab中颜色线形和形状

    1.颜色字符串有'c', 'm', 'y', 'r', 'g', 'b', 'w',和'k'.分别表示青,红紫,黄,红,绿,白和黑. 2.线型字符串有:'-' 为实线, '--' 为虚线, ':' 为 ...

  8. 实现IDisposable接口的模式

    代码: public class Class2 : IDisposable { ~Class2() { Dispose(false); } public void Dispose() { Dispos ...

  9. java中的匿名内部类

    匿名内部类在java编码中不是很常见,它可一让类实现多继承的特性(多个父类~1个子类) java中的匿名内部类总结http://www.cnblogs.com/nerxious/archive/201 ...

  10. [haoi2010]订货 最小费用流

    这道题oj上的标签是动态规划,但我想不出来动态规划怎么搞,空间不爆,时间也要爆的: 好的,不扯淡,此题正常做法是最小费用流: 这道题我写了两遍,为什么呢?原因是第一次写的时候,不会写费用流,又恰好没带 ...