Oracle ->> Oracle下查看实际执行计划的方法
2024-08-27 20:37:18
也许有很多种方法,这里只是书上学到的一种方法
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 |
------------------------------------------------------------------------------------------------------------
最新文章
- 文章转载利用border、transparent实现微风
- Git的简单使用教程
- 【英语魔法俱乐部——读书笔记】 2 中级句型-复句&;合句(Complex Sentences、Compound Sentences)
- 用Supervisord管理Python进程
- JS获取浏览器可视区域的尺寸
- Monad
- Couldn&#39;t load libPassword from loader:NDK开发中C文件编译成cpu对应的so类库时,找不到类库报错的原因之一
- 4.4、Libgdx用法查询执行环境相关性
- 一篇文章学会springMVC(转)
- Python+PyCharm的一些基本设置:安装使用、注册码、显示行号、字体大小和快捷键等常用设置
- leetcode python最长回文子串
- dskinlite(uieasy mfc界面库)使用记录3:绘制动态元素(按钮控件通过隐藏方式修改图片显示)
- phpcms 手机门户配置注意事项
- Go 初体验 - 令人惊叹的语法 - defer.1 - 基本概念和用法
- VBA字符串处理大全
- python 最小二乘拟合,反卷积,卡方检验
- 可变,不可变类型和hash
- 盾牌第一至七季/全集The Shield迅雷下载
- 利用python的KMeans和PCA包实现聚类算法
- 【转】【WPF】WPF - MVVM - 如何将ComboBox的Selectchange事件binding到ViewModel