‎2008 Apr 28 2:29 PM
Hi Gurus,
Can anyone tell me what needs to be done to improve performance of the below select statement.
If I give a range of plants it taking 4 mins to get 10344 records.
SELECT a~mblnr
a~budat
a~mjahr
b~ebeln
b~ebelp
b~matnr
INTO CORRESPONDING FIELDS OF TABLE li_temp_tab
FROM mkpf AS a INNER JOIN mseg AS b
ON amblnr = bmblnr
AND amjahr = bmjahr
WHERE a~budat IN s_budat
AND a~mjahr EQ p_mjahr
AND b~werks IN s_werks
AND b~prctr IN s_prctr
AND b~lifnr IN s_lifnr
AND b~bwart IN (gc_bwart,gc_bwart1,gc_bwart2)
AND b~matnr IN s_matnr.
Please let me know how I can improve the performance of this select statement.
Regards
Mac
‎2008 Apr 28 2:39 PM
Hi,
Check the indexes of MKPF and make sure you follow one of the indexes.
Run a performance trace with ST05 to see if additional performance improvements can be made.
regards,
bert
‎2008 Apr 28 2:33 PM
hi,
1. Remove Joins and select the data into two different internal tables using two select statements and finally move the data into final internal table.
2. Avoid using into corresponding entries statements and use into table statement.
Regards,
Santosh
‎2008 Apr 28 2:39 PM
Hi,
Check the indexes of MKPF and make sure you follow one of the indexes.
Run a performance trace with ST05 to see if additional performance improvements can be made.
regards,
bert
‎2008 Apr 28 2:43 PM
Hi,
You can create a Database view with this two tables MKPF and MSEG and then select data from this view.
Regards,
Fernando
‎2008 Apr 28 2:45 PM
hi check this...
1 .use all the keys(primary and secondary) for best performance
2.use the for all entries rather than the joins
use these conditions and check the performance in the st05.
regards,
venkat.
‎2008 Apr 28 3:05 PM
Is select option s_budat filled ? If not make sure you derive it from p_mjahr. MKPF has a secondary index on budat