Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Expensive SQL Statement

Former Member
0 Kudos
91

Hi Guys,

I have just received an email from our basis team where they said I am using an expensive SQL statement.

There is a loop on a table of people with the following statement

SELECT * FROM catsdb INTO TABLE w_cats

WHERE arbid EQ i_data-arbid

AND raufpl EQ i_data-aufpl

AND raplzl EQ i_data-aplzl

AND workdate IN s_wdate

AND status EQ '30'.

Is it me or is this the quickest way possible??

Can anyone think of a better way to do this??

Thanks Experts

2 REPLIES 2

former_member194613
Active Contributor
0 Kudos
48

First of all, did you ever hear about indices? Please check whether there is an index (SE11) with has fields of your WHERE-condition.

=> if this is not the case the it will be slow, until an index is created.

Second, change the LOOP into a FOR ALL ENTRIES, don't forget to check whether the itab is initial.

ThomasZloch
Active Contributor
0 Kudos
48

Also

Thomas