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 tuning about select

Former Member
0 Likes
502

hi experts:

in one case : select ** ** ** into table tab

from **

for all entries in t_tab

where ** = t_tab-**

and *** in ('1','2').

second case: select ** ** ** into table tab

from **

for all entries in t_tab

where ** = t_tab-**

and ' *** = '1' or ***= '2' '.

thirs case : select ** ** ** into table tab

from **

for all entries in t_tab

where ** = t_tab-**

and *** between '1' and '2'.

last case : select ** ** ** into table tab

from **

for all entries in t_tab

where ** = t_tab-**.

delete tab where *** > 2.

which case is the best??

Message was edited by:

chen xinrong

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
470

hi chen,

all these selects will be taking almost same time to execute. but the last case doesnt restrict the entires, ie it checks against only one field.the last case depends of the size of the table too.

and also check if the internal table (itab) has duplictae entries for the fields gefore using for all entries and check if the table is intial or not.

regards,

madhu

4 REPLIES 4
Read only

Former Member
0 Likes
470

Hi,

Based on your requirement you can mention the where condition.

If u want the records which have that filed values both 1 and 2 then u should give

          • = 1 and

            • = 2.

If u want either 1 or 2 then

          • = 1 or

            • = 2.

If u don't want both 1 and 2 value records then

Delette t_tab where ******* = 1 and

                • = 2.

your using the forall entries os you should chekc the table t_tab have the data or not. Otherwise performance will go down.Better to not use 'NO' operator in select statement.

Hope this helps you, reply for queries, Shall post you the updates.

Regards.

Kumar. .

Read only

h_senden2
Active Contributor
0 Likes
470

You can try it yourself by using transaction SE30 (Runtime analysis). Click on button "Tips and Tricks" and fill in the code and run it.

regards,

Hans

Please reward all helpful answers !!!!!

Read only

Former Member
0 Likes
470

Hi,

I think the best is case one.


select ** ** ** 
into table tab 
from **
for all entries in t_tab
where ** = t_tab-**
and *** in ('1','2').

But, please cek t_tab first:

Check t_tab[] is not initial.

Regards,

Read only

Former Member
0 Likes
471

hi chen,

all these selects will be taking almost same time to execute. but the last case doesnt restrict the entires, ie it checks against only one field.the last case depends of the size of the table too.

and also check if the internal table (itab) has duplictae entries for the fields gefore using for all entries and check if the table is intial or not.

regards,

madhu