当前位置:网站首页>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')
边栏推荐
- nxp官方uboot移植到野火开发板PRO(修改LCD部分和网络部分)
- FVCOM三维水动力、水交换、溢油物质扩散及输运数值模拟丨FVCOM模型流域、海洋水环境数值模拟方法
- 老板:公司系统太多,能不能实现账号互通?
- 嵌入式系统:GPIO
- Diazo Biotin-PEG3-DBCO|重氮化合物修饰生物素-三聚乙二醇-二苯并环辛炔
- XSS holes emersion
- AI首席架构师13-AICA-智能文档分析技术在行业场景中的应用
- What is the role and difference between buildscript and allprojects?
- 聚焦开源与联合共创|麒麟软件出席开源峰会欧拉分论坛
- for循环练习题
猜你喜欢
LabVIEW代码生成错误 61056
HCIP第十四天
一些思考:腾讯股价为何持续都低
CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
ValidationError: Progress Plugin Invalid Options
电商数仓ODS层-----日志数据装载
StoneDB 开源社区月刊 | 202207期
Data_web(八)mysql增量同步到mongodb
CAS:908007-17-0_Biotin-azide _生物素叠氮化物
[kali-vulnerability scanning] (2.1) Nessus lifts IP restrictions, scans quickly without results, and plugins are deleted (middle)
随机推荐
384. Shuffle an Array
HCIP第十六天
上课笔记(6)(1)——#629. 表达式括号匹配(stack)
CAS: 1192802-98-4 _uv cracking of biotin - PEG2 - azide
一些思考:腾讯股价为何持续都低
UVa 10003 - Cutting Sticks(白书,区间DP)
图的基础概念
电商数仓ODS层-----日志数据装载
【云原生实用技巧】使用 skopeo 批量同步 helm chart 依赖镜像
E-commerce data warehouse ODS layer-----log data loading
488. Zuma Game
如何设计 DAO 的 PoW 评判标准 并平衡不可能三角
[b01lers2020]Life on Mars
472. Concatenated Words
385. Mini Parser
C. Fishingprince Plays With Array--Codeforces Global Round 21
授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节试读版
JPA Native Query(本地查询)及查询结果转换
CAS:908007-17-0_Biotin-azide _生物素叠氮化物
XSS online shooting range---haozi