Download presentation
Presentation is loading. Please wait.
Published byGriffin Weatherly Modified over 9 years ago
1
1Jonathan Lewis EOUG Jun 2000 Execution Plans Explain Plan - part 2 Parallel - Partitions - Problems
2
2Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel - Partitions - Problems Execution Plans - reprise Interpreting Parallel Queries Interpreting Partition table queries New mysteries
3
3Jonathan Lewis EOUG Jun 2000 Execution Plans Execution Plans - reprise select ep1.v1, count(ep2.v2) fromep2, ep1 whereep2.v1 = 'Tyne Tees' andep1.n1 = ep2.n1 group by ep1.v1 order by count(ep2.v2) desc ;
4
4Jonathan Lewis EOUG Jun 2000 Execution Plans Execution Plans - reprise SELECT STATEMENT (choose) SORT (order by) SORT (group by) HASH JOIN TABLE ACCESS (analyzed) EP1 (full) TABLE ACCESS (analyzed) EP2 (full)
5
5Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution
6
6Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution SORT (order by) PARA_2_SERIAL:Q819004 SORT (group by) PARA_2_PARA:Q819003 HASH JOIN PARA_2_PARA:Q819002 TABLE ACCESS EP2(full) P_2_P :Q819000 TABLE ACCESS EP1(full) P_2_P :Q819001
7
7Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution
8
8Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution :Q819000SELECT /*+ NO_EXPAND ROWID(A1) */ A1."N1" C0,A1."V2" C1 FROM "EP2" A1 WHERE ROWID BETWEEN :B1 AND :B2 AND A1."V1"='Tyne Tees' :Q819001SELECT /*+ NO_EXPAND ROWID(A1) */ A1."N1" C0,A1."V1" C1 FROM "EP1" A1 WHERE ROWID BETWEEN :B1 AND :B2
9
9Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution :Q819004SELECT A1.C0 C0,A1.C1 C1 FROM:Q819003 A1 ORDER BY A1.C0 DESC :Q819003SELECT COUNT(A1.C1) C0,A1.C0 C1 FROM:Q819002 A1 GROUP BY A1.C0 :Q819002SELECT /*+ ORDERED NO_EXPAND USE_HASH(A2) */ A2.C1 C0,A1.C1 C1 FROM:Q819000 A1, :Q819001 A2 WHERE A2.C0=A1.C0
10
10Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution select tq_id, server_type, process, num_rows, bytes, waits from v$pq_tqstat order by tq_id, server_type desc;
11
11Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution ID SERVER_TYP PROCESS ROWS BYTES WAITS 0 Producer P005 67 1135 10 P004 67 1127 10 P003 66 1109 10 Consumer P002 80 1343 4 P000 58 982 4 P001 62 1046 4 1 Producer P005 78 16287 14 P004 66 13788 12 P003 56 11703 10 Consumer P002 80 16703 10 P000 57 11909 8 P001 63 13166 9
12
12Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution
13
13Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution SORT (order by) PARA_2_SERIAL:Q819002 SORT (group by) PARA_2_PARA:Q819001 NESTED LOOPS PARA_2_PARA :Q819000 TABLE ACCESS EP2(full) P_WITH_Parent TABLE ACCESS EP1(by index rowid) P_W_P INDEX UNIQUE EP1_PK (unique) P_W_P
14
14Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel Execution SELECT /*+ ORDERED NO_EXPAND USE_NL(A2) INDEX(A2 "EP1_PK") */ A2."V1" C0, A1.C1 C1 FROM (SELECT /*+ NO_EXPAND ROWID(A3) */ A3."N1" C0,A3."V2" C1 FROM "EP2" A3 WHERE ROWID BETWEEN :B1 AND :B2 AND A3."V1"='Tyne Tees' )A1, "EP1"A2 WHERE A2."N1" = A1.C0
15
15Jonathan Lewis EOUG Jun 2000 Execution Plans PQ Summary Node, Other, Other_tag V$PQ_TQSTAT Messages can be the main cost
16
16Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel - Partitions - Problems Partitioned tables
17
17Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables create table ep1 (n1, v1, v2) partition by range (n1) ( partition p1 values less than (50), partition p2 values less than (100), partition p3 values less than (150) ) as select...
18
18Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables select max(v1) from ep1 where n1 = 45 SORT (AGGREGATE) TABLE ACCESS (BY LOCAL INDEX ROWID) OF EP1 INDEX (UNIQUE SCAN) OF 'EP1_PK' (UNIQUE)
19
19Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables select max(v1) from ep1 where n1 between 45 and 60; SORT (AGGREGATE) PARTITION RANGE (ITERATOR) TABLE ACCESS (FULL) OF 'EP1'
20
20Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables create table ref_n1 (r1 number, c1 varchar2(10)); selectc1, max(n1) fromref_n1,ep1 whereref_n1.c1 like 'S%' and ep1.n1 = ref_n1.r1 group by ref_n1.c1;
21
21Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SORT (GROUP BY) NESTED LOOPS TABLE ACCESS (FULL) OF 'REF_N1' PARTITION RANGE (ITERATOR) INDEX (UNIQUE SCAN) OF 'EP1_PK' (UNIQUE)
22
22Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SORT (AGGREGATE) TABLE ACCESS (BY LOCAL INDEX ROWID) OF EP1 INDEX (UNIQUE SCAN) OF 'EP1_PK' (UNIQUE) SORT (aggregate) TABLE ACCESS (ana) JPL1 EP1 (by local index rowid) Pt id: 2 Pt Range: 1 - 1 INDEX (ana) UNIQUE JPL1 EP1_PK (range scan) Pt id: 2 Pt Range: 1 - 1
23
23Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SORT (AGGREGATE) PARTITION RANGE (ITERATOR) TABLE ACCESS (FULL) OF 'EP1' SORT (AGGREGATE) PARTITION RANGE (ITERATOR) Pt id: 2 Pt Range: 1 - 2 TABLE ACCESS (FULL) OF 'EP1' Pt id: 2 Pt Range: 1 - 2
24
24Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SORT (group by) NESTED LOOPS TABLE ACCESS REF_N1 (full) PARTITION RANGE (iterator) Pt id: 4 Pt Range: KEY - KEY INDEX (analyzed) UNIQUE EP1_PK (unique scan) Pt id: 4 Pt Range: KEY - KEY
25
25Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables select max(v1) from ep1 where n1 = to_number(:b1)
26
26Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SORT (aggregate) PARTITION RANGE (single) Pt id: 2 Pt Range: KEY - KEY TABLE ACCESS (ana) JPL1 EP1 (by local index rowid) Pt id: 2 Pt Range: KEY - KEY INDEX (analyzed) UNIQUE JPL1 EP1_PK (range scan) Pt id: 2 Pt Range: KEY - KEY
27
27Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables select ep1.v1, count(ep2.v2) fromep2, ep1 whereep2.v1 = 'Tyne Tees' andep2.n1 between 80 and 120 andep1.n1 = ep2.n1 group by ep1.v1
28
28Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Table SORT (GROUP BY) PARTITION RANGE (ITERATOR) HASH JOIN TABLE ACCESS (FULL) OF 'EP1' TABLE ACCESS (FULL) OF 'EP2' SORT (GROUP BY) HASH JOIN PARTITION RANGE (ITERATOR) TABLE ACCESS (FULL) OF 'EP1' PARTITION RANGE (ITERATOR) TABLE ACCESS (FULL) OF 'EP2'
29
29Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables create table ep1 (n1, v1, v2) partition by range (n1) ( partition p1 values less than (50), partition p2 values less than (100), partition p3 values less than (150), partition p4 values less than (250) ) as select...
30
30Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables create table ep2 (n1, n2, v1, v2) partition by range (n1) ( partition p1 values less than (51), partition p2 values less than (101), partition p3 values less than (151), partition p4 values less than (251) ) as select...
31
31Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SORT (group by) PARTITION RANGE(iterator) Ptid: 2 Pt Rng: 2-3 HASH JOIN TABLE ACCESS EP1(full)Ptid: 2 Pt Rng: 2-3 TABLE ACCESS EP2(full)Ptid: 2 Pt Rng: 2-3 SORT(group by) HASH JOIN PARTITION RANGE(iterator)Ptid: 3 Pt Rng: 2-3 TABLE ACCESS EP1(full)Ptid: 3 Pt Rng: 2-3 PARTITION RANGE(iterator)Ptid: 5 Pt Rng: 2-3 TABLE ACCESS EP2(full)Ptid: 5 Pt Rng: 2-3
32
32Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SELECT /*+ ORDERED NO_EXPAND USE_HASH(A2) SWAP_JOIN_INPUTS(A2) */ A2.C1 C0,A1.C1C1 FROM (SELECT /*+ NO_EXPAND FULL(A3) */ A3."N1" C0,A3."V2" C1 FROM "EP2" PARTITION(:B1) A3 WHERE A3."V1"='Tyne Tees' AND A3."N1">=80 AND A3."N1"<=120) A1, (SELECT /*+ NO_EXPAND FULL(A4) */ A4."N1" C0,A4."V1" C1 FROM "EP1" PARTITION(:B1)A4 WHERE A4."N1">=80 AND A4."N1"<=120) A2 WHERE A2.C0=A1.C0
33
33Jonathan Lewis EOUG Jun 2000 Execution Plans Partitioned Tables SELECT /*+ ORDERED NO_EXPAND USE_HASH(A2) SWAP_JOIN_INPUTS(A2)*/ A2.C1 C0,A1.C1 C1 FROM (SELECT /*+ NO_EXPAND FULL(A3) */ A3."N1" C0,A3."V2" C1 FROM "EP2" PARTITION_SET(1) A3 WHERE A3."V1"='Tyne Tees' AND A3."N1">=80 AND A3."N1"<=120) A1, :Q849000 A2 WHERE A2.C0=A1.C0 SELECT /*+ NO_EXPAND ROWID(A1) */ A1."N1" C0,A1."V1" C1 FROM "EP1" PARTITION(:B1) A1 WHERE ROWID BETWEEN :B2 AND :B3 AND A1."N1">=80 AND A1."N1"<=120
34
34Jonathan Lewis EOUG Jun 2000 Execution Plans Partition Summary Partition ID Partition Start / Partition Stop KEY - KEY vs strictly numbered Iterator / Single
35
35Jonathan Lewis EOUG Jun 2000 Execution Plans Parallel - Partitions - Problems Problems
36
36Jonathan Lewis EOUG Jun 2000 Execution Plans Problems select sum(sales_value) from rls_demo; SORT (AGGREGATE) TABLE ACCESS (FULL) OF 'RLS_DEMO'
37
37Jonathan Lewis EOUG Jun 2000 Execution Plans Problems SORT (AGGREGATE) NESTED LOOPS VIEW SORT (UNIQUE) TABLE ACCESS (FULL) OF 'RLS_CONTROL' TABLE ACCESS (FULL) OF 'RLS_DEMO'
38
38Jonathan Lewis EOUG Jun 2000 Execution Plans Problems 'owner in ( selectt.owner fromrls_control t wheremanager = sys_context(''rls_demo'',''role'') )'
39
39Jonathan Lewis EOUG Jun 2000 Execution Plans Problems create type jpl_item as object (n1 number, v1 varchar2(32)); / create type jpl_tab_type as table of jpl_item; / create table demo_nest ( idnumber, nestjpl_tab_type ) nested table nest store as t_nested;
40
40Jonathan Lewis EOUG Jun 2000 Execution Plans Problems select sum(n.n1) from demo_nestt, table(t.nest)n where n.v1 = 'asdf';
41
41Jonathan Lewis EOUG Jun 2000 Execution Plans Problems SORT (AGGREGATE) TABLE ACCESS (BY INDEX ROWID) OF 'T_NESTED' INDEX (RANGE SCAN) OF 'TN_V1' (NON-UNIQUE) Where has the parent table DEMO_NEST gone ?
42
42Jonathan Lewis EOUG Jun 2000 Execution Plans Problems selectit1.location, it1.sales, ( selectsum(sales) from inline_test ita where ita.area = it1.area andita.location_type = it1.location_type ) area_sales frominline_testit1 whereit1.location_type != 'WAREHOUSE';
43
43Jonathan Lewis EOUG Jun 2000 Execution Plans Problems SELECT STATEMENT Optimizer=CHOOSE TABLE ACCESS (FULL) OF 'INLINE_TEST' Where is the in-line table ?
44
44Jonathan Lewis EOUG Jun 2000 Execution Plans Problem Summary alter session set events ‘10046 trace name context forever, level 12’
45
45Jonathan Lewis EOUG Jun 2000 Execution Plans Conclusion ? ?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.