Subject | left join vs. inline-select |
---|---|
Author | Christian |
Post date | 2004-08-16T09:28:44Z |
Hi all,
these two calls display the same results, the inline-select after a
few ms,
the join after 7 sec.
What is the reason for this magnificant difference?
Why is the plan of the join natural und not by IX_LADEMITTEL_LM_NR?
Greetings Christian
SELECT
L.*,
(SELECT D.DO_NR FROM DOSSIER D WHERE D.DO_ID = L.DO_ID) AS DOSSIER
FROM LADEMITTEL L
ORDER BY L.LM_NR
------------------------------------
PLAN (L ORDER IX_LADEMITTEL_LM_NR)
PLAN (D INDEX (PK_DOSSIER))
------------------------------------
Indexed Read:
Dossier:93
Lademittel:96
NonIndexed: 0
------------------------------------
------------------------------------
SELECT
L.*,
D.DO_NR
FROM LADEMITTEL L
left JOIN DOSSIER D ON L.DO_ID = D.DO_ID
ORDER BY L.LM_NR
------------------------------------
PLAN SORT (JOIN (L NATURAL,D INDEX (PK_DOSSIER)))
Indexed Read:
Dossier:112.755
NonIndexed:
Lademittel:112.791
------------------------------------
------------------------------------
these two calls display the same results, the inline-select after a
few ms,
the join after 7 sec.
What is the reason for this magnificant difference?
Why is the plan of the join natural und not by IX_LADEMITTEL_LM_NR?
Greetings Christian
SELECT
L.*,
(SELECT D.DO_NR FROM DOSSIER D WHERE D.DO_ID = L.DO_ID) AS DOSSIER
FROM LADEMITTEL L
ORDER BY L.LM_NR
------------------------------------
PLAN (L ORDER IX_LADEMITTEL_LM_NR)
PLAN (D INDEX (PK_DOSSIER))
------------------------------------
Indexed Read:
Dossier:93
Lademittel:96
NonIndexed: 0
------------------------------------
------------------------------------
SELECT
L.*,
D.DO_NR
FROM LADEMITTEL L
left JOIN DOSSIER D ON L.DO_ID = D.DO_ID
ORDER BY L.LM_NR
------------------------------------
PLAN SORT (JOIN (L NATURAL,D INDEX (PK_DOSSIER)))
Indexed Read:
Dossier:112.755
NonIndexed:
Lademittel:112.791
------------------------------------
------------------------------------