当前位置:网站首页>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')
边栏推荐
猜你喜欢
随机推荐
HCIP第十六天
E-commerce data warehouse ODS layer-----log data loading
数据一致性:双删为什么要延时?
376. Wiggle Subsequence
IO thread process -> thread synchronization mutual exclusion mechanism -> day6
pikachu Over permission 越权
CAS: 773888-45-2_BIOTIN ALKYNE_生物素-炔基
Soft exam system analysts note experience sharing: theory of protracted war
授人以渔 - 如何自行查询任意 SAP UI5 控件属性的文档和技术实现细节试读版
Pay from 0 to 1
今晚直播 | 8.2-8.4 与你聊聊开源与就业那些事!
[N1CTF 2018]eating_cms
编译器工程师眼中的好代码(1):Loop Interchange
亿流量大考(2):开发一套高容错分布式系统
DO280管理和监控OpenShift平台--资源限制
嵌入式系统:时钟
上课笔记(6)(1)——#629. 表达式括号匹配(stack)
聚焦开源与联合共创|麒麟软件出席开源峰会欧拉分论坛
466. Count The Repetitions
[kali-vulnerability exploitation] (3.2) Metasploit basics (on): basic knowledge