当前位置:网站首页>2022-08-03 Oracle executes slow SQL-Q17 comparison
2022-08-03 Oracle executes slow SQL-Q17 comparison
2022-08-03 22:10:00 【Emperor Zun Wu Shi】
Environment:
The most stable version 11.2.0.4 of oracle 11g is installed on 30.119, and 10g tpch data has been imported
Log in to the oracle database
su - oracle
sqlplus test/oracle // tpch data are created under the test user, has been given dba permission
10g data, slow sql17 execution takes 7 seconds in oracle
SQL> select2 sum(l_extendedprice) / 7.0 as avg_yearly3 from4 lineitem,5 part6 where7 p_partkey = l_partkey8 and p_brand = 'Brand#23'9 and p_container = 'MED BOX'10 and l_quantity < (11 select12 0.2 * avg(l_quantity)13 from14 lineitem15 where16 l_partkey = p_partkey17);AVG_YEARLY------------3295493.51Elapsed: 00:00:07.51
Take slow sql17 as an example, query the sql execution plan
explain plan for selectsum(l_extendedprice) / 7.0 as avg_yearlyfromlineitem,partwherep_partkey = l_partkeyand p_brand = 'Brand#23'and p_container = 'MED BOX'and l_quantity < (select0.2 * avg(l_quantity)fromlineitemwherel_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')
边栏推荐
- 基于支持向量机的网络⼊侵检测系统的全面调查和分类
- UVa 1025 - A Spy in the Metro(白书)
- 一文带你了解软件测试是干什么的?薪资高不高?0基础怎么学?
- 距LiveVideoStackCon 2022 上海站开幕还有2天!
- 关于GPIO你真的懂了吗?这篇文章都给你整理好了
- CAS:908007-17-0_Biotin-azide_Biotin azide
- Data_web(八)mysql增量同步到mongodb
- CAS:122567-66-2_DSPE-生物素_DSPE-Biotin
- CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
- [b01lers2020]Life on Mars
猜你喜欢
CAS: 1192802-98-4 _uv cracking of biotin - PEG2 - azide
[kali-vulnerability exploitation] (3.2) Metasploit basics (on): basic knowledge
Data_web(八)mysql增量同步到mongodb
113. Teach a Man how to fish - How to query the documentation and technical implementation details of any SAP UI5 control property by yourself
noip preliminary round
Go开发工具GoLand V2022.2 来了——Go 工作区重大升级
投资性大于游戏性 NFT游戏到底是不是门好生意
CAS:1260586-88-6_Biotin-C5-Azide_Biotin-C5-Azide
CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl
Diazo Biotin-PEG3-DBCO|重氮化合物修饰生物素-三聚乙二醇-二苯并环辛炔
随机推荐
投资性大于游戏性 NFT游戏到底是不是门好生意
Android build error: Plugin with id 'kotlin-android' not found.
CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
趣链的产品构架
编译器工程师眼中的好代码(1):Loop Interchange
函数,递归以及dom简单操作
[b01lers2020]Life on Mars
UVa 10003 - Cutting Sticks(白书,区间DP)
mysql如何将表结构导出到excel
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
CAS: 773888-45-2_BIOTIN ALKYNE_Biotin-alkynyl
【MySQL进阶】数据库与表的创建和管理
What is the role and difference between buildscript and allprojects?
Soft exam system analysts note experience sharing: theory of protracted war
CAS:153162-70-0_N-BOC-6-生物素酰氨基己胺
How to write a database document management tool based on WPF (2)
老板:公司系统太多,能不能实现账号互通?
关于GPIO你真的懂了吗?这篇文章都给你整理好了
超级实用网站+公众号合集
授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节试读版