当前位置:网站首页>2022-08-03 oracle执行慢SQL-Q17对比
2022-08-03 oracle执行慢SQL-Q17对比
2022-08-03 22:06:00 【帝尊悟世】
环境:
30.119上安装了oracle 11g最稳定版本11.2.0.4,已经导入10g tpch数据
登录oracle数据库
su - oracle
sqlplus test/oracle // tpch数据都创建在test用户下,已赋予dba权限
10g数据,在oracle中慢sql17执行需要7秒
SQL> select
2 sum(l_extendedprice) / 7.0 as avg_yearly
3 from
4 lineitem,
5 part
6 where
7 p_partkey = l_partkey
8 and p_brand = 'Brand#23'
9 and p_container = 'MED BOX'
10 and l_quantity < (
11 select
12 0.2 * avg(l_quantity)
13 from
14 lineitem
15 where
16 l_partkey = p_partkey
17 );
AVG_YEARLY
----------
3295493.51
Elapsed: 00:00:07.51以慢sql17为例,查询sql执行计划
explain plan for select
sum(l_extendedprice) / 7.0 as avg_yearly
from
lineitem,
part
where
p_partkey = l_partkey
and p_brand = 'Brand#23'
and p_container = 'MED BOX'
and l_quantity < (
select
0.2 * avg(l_quantity)
from
lineitem
where
l_partkey = p_partkey
);
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plan hash value: 3341365018
------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 13 | | 309K (1)| 01:01:56 |
| 1 | SORT AGGREGATE | | 1 | 13 | | | |
| 2 | VIEW | VW_WIF_1 | 60082 | 762K| | 309K (1)| 01:01:56 |
| 3 | WINDOW SORT | | 60082 | 2522K| 3328K| 309K (1)| 01:01:56 |
|* 4 | HASH JOIN | | 60082 | 2522K| | 308K (1)| 01:01:48 |
|* 5 | TABLE ACCESS FULL| PART | 2000 | 56000 | | 10473 (1)| 00:02:06 |
| 6 | TABLE ACCESS FULL| LINEITEM | 59M| 858M| | 298K (1)| 00:59:40 |
------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("P_PARTKEY"="L_PARTKEY")
5 - filter("P_CONTAINER"='MED BOX' AND "P_BRAND"='Brand#23')

边栏推荐
- [kali-vulnerability scanning] (2.1) Nessus download and installation (on)
- [b01lers2020]Life on Mars
- CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
- Makefile
- 如何基于WPF写一款数据库文档管理工具(二)
- 2022年全国职业院校技能大赛网络安全 B模块 任务十windows操作系统渗透测试 国赛原题
- What is the role and difference between buildscript and allprojects?
- Go开发工具GoLand V2022.2 来了——Go 工作区重大升级
- 九种方式,教你读取 resources 目录下的文件路径
- 21天打卡挑战学习MySQL——《Window下安装MySql》第一周 第三篇
猜你喜欢

深度学习和机器学习有什么区别?

StoneDB 开源社区月刊 | 202207期

电商数仓ODS层-----日志数据装载

一些思考:腾讯股价为何持续都低

Cisco ike2 IPSec configuration
![[kali-vulnerability exploitation] (3.2) Metasploit basics (on): basic knowledge](/img/49/117de5147a34e6a957f74880b4f597.png)
[kali-vulnerability exploitation] (3.2) Metasploit basics (on): basic knowledge

6. XML

Go开发工具GoLand V2022.2 来了——Go 工作区重大升级

易基因:植物宏病毒组研究:植物病毒的进化与生态 | 顶刊综述
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
随机推荐
电商数仓ODS层-----日志数据装载
VLAN实验
nxp官方uboot移植到野火开发板PRO(无任何代码逻辑的修改)
趣链的产品构架
HCIP第十六天
Cross-end development technical reserve record
CAS:908007-17-0_Biotin-azide _生物素叠氮化物
《强化学习周刊》第56期:GraphIRL、REDEEMER & 眼科强化学习的潜在研究
软件测试人员必备的60个测试工具清单,建议收藏一波~
CAS: 1192802-98-4 _uv cracking of biotin - PEG2 - azide
一体化HTAP数据库如此难,为什么他们还要做?
函数,递归以及dom简单操作
从0到1看支付
深度学习和机器学习有什么区别?
一文带你了解软件测试是干什么的?薪资高不高?0基础怎么学?
嵌入式开发:嵌入式基础——代码和数据空间揭秘
shell编程基础
L2-041 插松枝
XSS holes emersion
LyScript 实现应用层钩子扫描器