hi experts,
i have done SQL Trace on select statements using joins and for all entries.
case1: using joins and time taken : 2.249.936
case2: using for all entries and time taken : 3.074.469
Clearly i can see that join is bit faster than for all entries.But i would like to know in which cases for all entries is faster than joins
and the cases in which joins are faster than for all entries.
i can see data being fetched from only KNA1 table in ST05 but i get data from KNB1 even.Without a fetch on KNB1,how am i getting data from
KNB1 using joins.??
Please advise
TABLES: kna1.
SELECT-OPTIONS:s_kunnr for kna1-kunnr.
data: BEGINOF it_cust OCCURS0,
kna1 type kna1,
knb1 type knb1,
ENDOF it_cust.
data: it_kna1 typeSTANDARDTABLEOF kna1,
it_knb1 typeSTANDARDTABLEOF knb1.
*using joins
select * INTO TABLE it_cust from kna1 INNER JOIN knb1 on kna1~kunnr = knb1~kunnr
where kna1~kunnr in s_kunnr.
*time taken : 2.249.936
*using for all entries
SELECT * from kna1 INTOTABLE it_kna1 where kunnr in s_kunnr .
ifnot it_kna1 isINITIAL.
SELECT * from knb1 intoTABLE it_knb1 FORALL ENTRIES IN it_kna1 WHERE kunnr = it_kna1-kunnr .
endif.
*time taken : 3.074.469