Skip to Content
0
Former Member
Feb 14, 2009 at 05:58 AM

Select query with primary key on RESB taking too long

604 Views

Hello All,

The below Select query is taking about 1 Hour to run on production. I have done some analysis and the correct index is being selected.

The query is :

IF it_aufnr[] IS NOT INITIAL.                              
    SELECT rsnum
           rspos
           matnr
           werks
	   lgort
           shkzg 
   	   aufnr
           bdmng
           enmng                       
           FROM  resb INTO  TABLE it_rsnum FOR ALL ENTRIES IN it_aufnr
           WHERE rsnum EQ it_aufnr-rsnum
           AND   xloek NE 'X'
           AND   postp NE 'X'
           AND   resb~bdmng GE resb~enmng.
  ENDIF.

Database Table RESB: 40,000,000 Records (40 Million)

Internal Table it_aufnr: 20,000 Entries

Entries selected from RESB: 150,000.

Any ideas on how I could improve the performance ?

Thanks,

Shruthi