Skip to Content
Former Member
Mar 16, 2009 at 06:53 AM

sql performance tuning


Hi all,

I have an SQL query with poor performance that it runs for at least 8 hrs +, I've tried to fine-tune it in many ways, but not much improvement is found:


ranges r_equnr for afih-equnr.

ranges r_ilart for afih-ilart.

r_equnr-sign = 'I'.

r_equnr-option = 'CP'.

r_equnr-low = '00000000001*'.

append r_equnr.

r_ilart-sign = 'I'.

r_ilart-option = 'CP'.

r_ilart-low = 'A*'.

append r_ilart.

select aufnr from afih into table itab

where equnr in r_equnr and ilart in r_ilart.

select aaufnr amblnr amjahr azeile b~budat

into corresponding fields of table rtab

from mseg as a inner join mkpf as b

on amblnr = bmblnr and amjahr = bmjahr

for all entries in itab

where aaufnr = itab-aufnr and bcpudt in s_date

and ( abwart = '261' or abwart = '262' ).

Any suggestion to greatly improve the performance?

Many Thanks.