Oracle ->> Oracle下查看实际执行计划的方法
也许有很多种方法,这里只是书上学到的一种方法
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下查看实际执行计划的方法的更多相关文章
- Oracle之SQL优化专题02-稳固SQL执行计划的方法
首先构建一个简单的测试用例来实际演示: create table emp as select * from scott.emp; create table dept as select * from ...
- Oracle之SQL优化专题01-查看SQL执行计划的方法
在我2014年总结的"SQL Tuning 基础概述"中,其实已经介绍了一些查看SQL执行计划的方法,但是不够系统和全面,所以本次SQL优化专题,就首先要系统的介绍一下查看SQL执 ...
- Oracle查看SQL执行计划的方式
Oracle查看SQL执行计划的方式 获取Oracle sql执行计划并查看执行计划,是掌握和判断数据库性能的基本技巧.下面案例介绍了多种查看sql执行计划的方式: 基本有以下几种方式: ...
- 如何查看MySQL执行计划
在介绍怎么查看MySQL执行计划前,我们先来看个后面会提到的名词解释: 覆盖索引: MySQL可以利用索引返回select列表中的字段,而不必根据索引再次读取数据文件 包含所有满足查询需要的数据的索引 ...
- EXPLAIN 查看 SQL 执行计划
EXPLAIN 查看 SQL 执行计划.分析索引的效率: id:id 列数字越大越先执行: 如果说数字一样大,那么就从上往下依次执行,id列为null的就表是这是一个结果集,不需要使用它来进行查询. ...
- 查看SQL执行计划
一用户进入某界面慢得要死,查看SQL执行计划如下(具体SQL语句就不完全公布了,截断的如下): call count cpu elapsed disk ...
- 查看Mysql执行计划
使用navicat查看mysql执行计划: 打开profile分析工具: 查看是否生效:show variable like ‘%profil%’; 查看进程:show processlist; 选择 ...
- sql-查看执行计划的方法
sql执行计划:把SQL语句拆分为每个的操作步骤组合,按照一定的顺序执行得出结果,查看并看懂执行计划是调优的关键步骤 查看执行计划的方法 DBMS_XPLAN包 sql*plus AUTO trace ...
- linux下查看某个文件位置的方法
linux下查看某个文件位置的方法: 例如,不知道apache的配置文件httpd.conf的位置,可以有两种方法来查看: 1.find / -name httpd.conf2.locate http ...
随机推荐
- 四则运算2--设计思路--软件工程-c++
1.题目避免重复. 2.可定制(数量 打印方式). 3.可以控制下列参数:是否有乘除法.是否有括号.数值范围.加减有无负数.除法有无余数.是否支持分数(真分数,假分数...).是否支持小数(精确到多少 ...
- Spring MVC常用的注解类
一.注解类配置 要使用springmvc的注解类,需要在springmvc.xml配置文件中用context:component-scan/扫描:  二.五大重要的注解类 1.RequestMapp ...
- 【Integer To Roman】cpp
题目: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from ...
- Geo-Fence
转自:http://blog.jobbole.com/86633/ 地理围栏(Geo-fencing)是LBS的一种应用,就是用一个虚拟的栅栏围出一个虚拟地理边界,当手机进入.离开某个特定地理区域,或 ...
- WPS for ubuntu14
QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries. sudo apt-get ins ...
- bzoj 2751 快速幂
首先我们知道,对于所有种情况,我们可以将每一位可以放的 数的值加起来,所有位置的乘起来,等于的就是最后的答案,具体 为什么正确,可以根据乘法分配律来想一想. 那么对于所有不做要求的,快速幂直接算就行了 ...
- JS数组2(冒泡排列、数组里面查找数据)
数组 一.冒泡排列 对数组attr = [1,8,6,4,5,3,7,2,9]进行由大到小排列,用冒泡排列的方法排列时,会对数组进行比较互换.如果前一个数字较大,这2个元素排列方式不变,如果后一个元素 ...
- mysql同时修改2个表思路
1.需求:修改评论表中的昵称为手机号码最后4位. ,) AND issuer_name LIKE '1%'; 2.由于误操作(MID(issuer_name,4,6)是中间的6位),需要数据回滚. 3 ...
- sshd_config配置 详解
原文:http://blog.licess.org/sshd_config/ # 1. 关于 SSH Server 的整体设定,包含使用的 port 啦,以及使用的密码演算方式 Port 22 # S ...
- iOS多线程的初步研究(二)-- 锁
谈到线程同步,一般指如何对线程间共享数据的同步读写,如何避免混乱的读写结果.一个基本的解决办法就是使用锁(LOCK). iOS提供多种同步锁的类和方法,这里介绍下基本用法. 1. NSLock:最基本 ...