jvdmunt
1st June 2004, 10:43
We have two (nearly) identical systems with baan5c and oracle 8.1.7.
For the same query the reaction is difference; on system A is takes 2 minutes
(30982 rows), on system P is takes 2,5 hours (36930 rows)!
I did some investigation via tkprof. The SQL-query that ORACLE receives is on both systems equal
But the ORACLE execution plan is difference (see below)
- Why is ORACLE react difference???? and adds a MERGE JOIN CARTESIAN. Is this due "commands" oracle received from the db-driver (oracle8, equal on both systems)?
When I apply the query in SQLPLUS (without the hint /*+ FIRST_ROWS */) I face no problem (with hint I must wait 2,5 hour)
System A:
SELECT /*+ FIRST_ROWS */ a.t$drct,a.t$coun,b.t$orno,c.t$bpid,c.t$nama,
d.t$pono,d.t$otbp,d.t$item,d.t$citg,d.t$oltp,d.t$oqua,d.t$ddta,d.t$ddtb,
d.t$ddtc,d.t$ddtd,d.t$ddte,d.t$dqua,d.t$clyn,e.t$kitm,e.t$dsca,f.t$dsca
FROM
baan.ttdpur094400 a,baan.ttdpur400400 b,baan.ttccom100400 c,
baan.ttdpur401400 d,baan.ttcibd001400 e,baan.ttcmcs023400 f WHERE c.t$bpid =
b.t$otbp AND e.t$citg = f.t$citg AND e.t$kitm <> :1 AND a.t$coun = :2 AND
a.t$drct = :2 AND b.t$cotp = a.t$potp AND b.t$orno = d.t$orno AND d.t$item =
e.t$item ORDER BY 4,9,8,3,6
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 15492 5.03 51.67 5389 163519 385 30982
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 15494 5.03 51.67 5389 163519 385 30982
Misses in library cache during parse: 0
Optimizer goal: FIRST_ROWS
Parsing user id: 23
Rows Row Source Operation
------- ---------------------------------------------------
30982 SORT ORDER BY
30982 NESTED LOOPS
30983 NESTED LOOPS
32986 NESTED LOOPS
11611 NESTED LOOPS
11611 NESTED LOOPS
12688 TABLE ACCESS FULL TTDPUR400400
24297 TABLE ACCESS BY INDEX ROWID TTDPUR094400
25374 INDEX UNIQUE SCAN (object id 273756)
23220 TABLE ACCESS BY INDEX ROWID TTCCOM100400
23220 INDEX UNIQUE SCAN (object id 272999)
44595 TABLE ACCESS BY INDEX ROWID TTDPUR401400
44595 INDEX RANGE SCAN (object id 273894)
63967 TABLE ACCESS BY INDEX ROWID TTCIBD001400
65970 INDEX UNIQUE SCAN (object id 273230)
30982 TABLE ACCESS BY INDEX ROWID TTCMCS023400
61964 INDEX UNIQUE SCAN (object id 273348)
System P:
SELECT /*+ FIRST_ROWS */ a.t$drct,a.t$coun,b.t$orno,c.t$bpid,c.t$nama,
d.t$pono,d.t$otbp,d.t$item,d.t$citg,d.t$oltp,d.t$oqua,d.t$ddta,d.t$ddtb,
d.t$ddtc,d.t$ddtd,d.t$ddte,d.t$dqua,d.t$clyn,e.t$kitm,e.t$dsca,f.t$dsca
FROM
baan.ttdpur094100 a,baan.ttdpur400100 b,baan.ttccom100100 c,
baan.ttdpur401100 d,baan.ttcibd001100 e,baan.ttcmcs023100 f WHERE c.t$bpid =
b.t$otbp AND e.t$citg = f.t$citg AND e.t$kitm <> :1 AND a.t$coun = :2 AND
a.t$drct = :2 AND b.t$cotp = a.t$potp AND b.t$orno = d.t$orno AND d.t$item =
e.t$item ORDER BY 4,9,8,3,6
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.01 0 0 0 0
Fetch 18466 7862.62 7884.75 6560 892561791 381 36930
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 18468 7862.62 7884.76 6560 892561791 381 36930
Misses in library cache during parse: 1
Optimizer goal: FIRST_ROWS
Parsing user id: 22
Rows Row Source Operation
------- ---------------------------------------------------
36930 SORT ORDER BY
36930 NESTED LOOPS
344962350 NESTED LOOPS
2331488 MERGE JOIN CARTESIAN
13962 NESTED LOOPS
15207 NESTED LOOPS
4372 TABLE ACCESS FULL TTCCOM100100
19577 TABLE ACCESS BY INDEX ROWID TTDPUR400100
19577 INDEX RANGE SCAN (object id 8400)
29167 TABLE ACCESS BY INDEX ROWID TTDPUR094100
30412 INDEX UNIQUE SCAN (object id 14182)
2345448 SORT JOIN
167 TABLE ACCESS FULL TTCMCS023100
347293836 TABLE ACCESS BY INDEX ROWID TTCIBD001100
348005847 INDEX RANGE SCAN (object id 13975)
36930 TABLE ACCESS BY INDEX ROWID TTDPUR401100
344999279 INDEX RANGE SCAN (object id 147446)
For the same query the reaction is difference; on system A is takes 2 minutes
(30982 rows), on system P is takes 2,5 hours (36930 rows)!
I did some investigation via tkprof. The SQL-query that ORACLE receives is on both systems equal
But the ORACLE execution plan is difference (see below)
- Why is ORACLE react difference???? and adds a MERGE JOIN CARTESIAN. Is this due "commands" oracle received from the db-driver (oracle8, equal on both systems)?
When I apply the query in SQLPLUS (without the hint /*+ FIRST_ROWS */) I face no problem (with hint I must wait 2,5 hour)
System A:
SELECT /*+ FIRST_ROWS */ a.t$drct,a.t$coun,b.t$orno,c.t$bpid,c.t$nama,
d.t$pono,d.t$otbp,d.t$item,d.t$citg,d.t$oltp,d.t$oqua,d.t$ddta,d.t$ddtb,
d.t$ddtc,d.t$ddtd,d.t$ddte,d.t$dqua,d.t$clyn,e.t$kitm,e.t$dsca,f.t$dsca
FROM
baan.ttdpur094400 a,baan.ttdpur400400 b,baan.ttccom100400 c,
baan.ttdpur401400 d,baan.ttcibd001400 e,baan.ttcmcs023400 f WHERE c.t$bpid =
b.t$otbp AND e.t$citg = f.t$citg AND e.t$kitm <> :1 AND a.t$coun = :2 AND
a.t$drct = :2 AND b.t$cotp = a.t$potp AND b.t$orno = d.t$orno AND d.t$item =
e.t$item ORDER BY 4,9,8,3,6
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 15492 5.03 51.67 5389 163519 385 30982
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 15494 5.03 51.67 5389 163519 385 30982
Misses in library cache during parse: 0
Optimizer goal: FIRST_ROWS
Parsing user id: 23
Rows Row Source Operation
------- ---------------------------------------------------
30982 SORT ORDER BY
30982 NESTED LOOPS
30983 NESTED LOOPS
32986 NESTED LOOPS
11611 NESTED LOOPS
11611 NESTED LOOPS
12688 TABLE ACCESS FULL TTDPUR400400
24297 TABLE ACCESS BY INDEX ROWID TTDPUR094400
25374 INDEX UNIQUE SCAN (object id 273756)
23220 TABLE ACCESS BY INDEX ROWID TTCCOM100400
23220 INDEX UNIQUE SCAN (object id 272999)
44595 TABLE ACCESS BY INDEX ROWID TTDPUR401400
44595 INDEX RANGE SCAN (object id 273894)
63967 TABLE ACCESS BY INDEX ROWID TTCIBD001400
65970 INDEX UNIQUE SCAN (object id 273230)
30982 TABLE ACCESS BY INDEX ROWID TTCMCS023400
61964 INDEX UNIQUE SCAN (object id 273348)
System P:
SELECT /*+ FIRST_ROWS */ a.t$drct,a.t$coun,b.t$orno,c.t$bpid,c.t$nama,
d.t$pono,d.t$otbp,d.t$item,d.t$citg,d.t$oltp,d.t$oqua,d.t$ddta,d.t$ddtb,
d.t$ddtc,d.t$ddtd,d.t$ddte,d.t$dqua,d.t$clyn,e.t$kitm,e.t$dsca,f.t$dsca
FROM
baan.ttdpur094100 a,baan.ttdpur400100 b,baan.ttccom100100 c,
baan.ttdpur401100 d,baan.ttcibd001100 e,baan.ttcmcs023100 f WHERE c.t$bpid =
b.t$otbp AND e.t$citg = f.t$citg AND e.t$kitm <> :1 AND a.t$coun = :2 AND
a.t$drct = :2 AND b.t$cotp = a.t$potp AND b.t$orno = d.t$orno AND d.t$item =
e.t$item ORDER BY 4,9,8,3,6
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.01 0 0 0 0
Fetch 18466 7862.62 7884.75 6560 892561791 381 36930
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 18468 7862.62 7884.76 6560 892561791 381 36930
Misses in library cache during parse: 1
Optimizer goal: FIRST_ROWS
Parsing user id: 22
Rows Row Source Operation
------- ---------------------------------------------------
36930 SORT ORDER BY
36930 NESTED LOOPS
344962350 NESTED LOOPS
2331488 MERGE JOIN CARTESIAN
13962 NESTED LOOPS
15207 NESTED LOOPS
4372 TABLE ACCESS FULL TTCCOM100100
19577 TABLE ACCESS BY INDEX ROWID TTDPUR400100
19577 INDEX RANGE SCAN (object id 8400)
29167 TABLE ACCESS BY INDEX ROWID TTDPUR094100
30412 INDEX UNIQUE SCAN (object id 14182)
2345448 SORT JOIN
167 TABLE ACCESS FULL TTCMCS023100
347293836 TABLE ACCESS BY INDEX ROWID TTCIBD001100
348005847 INDEX RANGE SCAN (object id 13975)
36930 TABLE ACCESS BY INDEX ROWID TTDPUR401100
344999279 INDEX RANGE SCAN (object id 147446)