当前位置:网站首页>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')

边栏推荐
- E-commerce data warehouse ODS layer-----log data loading
- Pay from 0 to 1
- FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment
- CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
- 【进阶自动化测试】一文1000教你如何用Postman做接口自动化测试
- 老板:公司系统太多,能不能实现账号互通?
- dataframe multi-level index replace index df.swaplevel(axis=1)
- Cisco ike2 IPSec配置
- 【Odoo】硬核组件开发,全文没一句废话~
- Data_web(九)mongodb增量同步到mongodb
猜你喜欢

XSS practice - cycle and two cycle problem at a time

XSS testing

shell编程基础

CAS:153162-70-0_N-BOC-6-Biotinamidohexylamine

gtk实现图片旋转

CAS:1260586-88-6_生物素-C5-叠氮_Biotin-C5-Azide

Cisco ike2 IPSec配置

FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment

Data_web(八)mysql增量同步到mongodb

CAS:1620523-64-9_Azide-SS-biotin_生物素-二硫-叠氮
随机推荐
【进阶自动化测试】一文1000教你如何用Postman做接口自动化测试
StoneDB 助力 2022 开放原子全球开源峰会
[kali-vulnerability scanning] (2.1) Nessus lifts IP restrictions, scans quickly without results, and plugins are deleted (middle)
B. Paranoid String
CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
386. Lexicographical Numbers
C. Divan and bitwise operations
封装、包、访问权限修饰符、static变量
HDU 5655 CA Loves Stick
中国企业构建边缘计算解决方案的最佳实践
HCIP第十四天
488. Zuma Game
CAS: 773888-45-2_BIOTIN ALKYNE_生物素-炔基
mysql如何将表结构导出到excel
A. Color the Picture- Codeforces Round #810 (Div. 1)
MMA安装及使用优化
C. Fishingprince Plays With Array--Codeforces Global Round 21
决策树、GBDT、XGBOOST树的可视化
How to deal with commas in the content of the CSV file of the system operation and maintenance series
XSS online shooting range---Warmups