Application Development and Automation 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: 
Read only

Performance Issue

Former Member
0 Likes
643

This statement is taking more time.

How to improve the performance of this statement

SELECT DISTINCT cbukrs cwaers cprctr bkostl

akstar aversn a~gjahr

ap001 ap002 ap003 ap004 ap005 ap006

ap007 ap008 ap009 ap010 ap011 ap012

ap013 ap014 ap015 ap016

APPENDING TABLE itab_temp

FROM zvcoss AS a

JOIN zvcssl AS b ON aobjnr = bobjnr

JOIN zkcsks AS c ON bkostl = ckostl

WHERE ( a~lednr EQ '00'

AND a~versn EQ '000'

AND b~kostl IN r_ccde

AND a~wrttp EQ '04'

AND a~gjahr EQ p_fy

AND a~kstar GE '0000000000'

AND a~kstar LE '0000999999' ) .

6 REPLIES 6
Read only

Former Member
0 Likes
614

try to minimize conditins in where clasue

ranges : r_kstar for zvcoss-kstar.

r_kstar-option = 'BT'

r_kstar-sign = 'I'

r_kstar-low = '0000000000'.

r_kstar-high = '0000999999' .

append r_kstar.

clear r_kstar.

<b>AND a~kstar in r_kstar.</b>

regards

Prabhu

Read only

Former Member
0 Likes
614

Hi,

Try this :

1. do not use appending table clause.

2. use index keys in joins

Hope this will help.

Read only

Former Member
0 Likes
614

hi jogdand,

can you tell me clearly abt the index key u have mentioned

Read only

Former Member
0 Likes
614

Hi,

1.Avoid APPENDING CLAUSE in the select query.instead use temporary internal table and move into the final internal table.

2. Split the joins.

You can first go for a join on zkcsks and zvcssl and fetch the required records.

delete the duplicate entries and check if the table is inital. and then for all entries to fetch the data from zvcoss .

regards,

madhu

Read only

Former Member
0 Likes
614

1.Select Distinct will cause perfromance issues, try to select the entire data and then use delete adjacent duplicates statement.

2. Try using brackets as given below for the join:

FROM ( ( zvcoss AS a JOIN zvcssl AS b

ON aobjnr = bobjnr )

JOIN zkcsks AS c ON bkostl = ckostl )

Read only

Former Member
0 Likes
614

hi,

please remove distinct.

it will try to modify the database when executing this select and the results can be quite dangerous.

even now if the perfromance does not improve try For all entries statement..

thanks

Sunder