当前位置:网站首页>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.51Take 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')
边栏推荐
猜你喜欢
随机推荐
距LiveVideoStackCon 2022 上海站开幕还有3天!
易基因|RNA m5C甲基化测序(RNA-BS)技术介绍
[kali-vulnerability scanning] (2.1) Nessus lifts IP restrictions, scans quickly without results, and plugins are deleted (middle)
Kubernetes入门到精通-Operator 模式
CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
VLAN实验
基于支持向量机的网络⼊侵检测系统的全面调查和分类
Makefile
嵌入式开发:嵌入式基础——代码和数据空间揭秘
CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
How to write a database document management tool based on WPF (2)
《强化学习周刊》第56期:GraphIRL、REDEEMER & 眼科强化学习的潜在研究
亿流量大考(2):开发一套高容错分布式系统
382. Linked List Random Node
东西向和南北向通信的统一
线上服务器老是卡,该如何优化?
趣链的产品构架
Soft exam system analysts note experience sharing: theory of protracted war
距LiveVideoStackCon 2022 上海站开幕还有2天!
Adobe是什么?









