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: 

Need to improve the performance

Former Member
0 Kudos

Hi,

New fields are added in the standard table,Before the we used select single * from the table in program,Now because of those fields it reduced the performance,How to improve the performance of the select queary.

Thanks in advance

5 REPLIES 5

JozsefSzikszai
Active Contributor
0 Kudos

hi Lakshmi,

if your SELECT SINGLE contains in its WHERE conditions all the key fields of the table (and only those!) than the reason is elsewhere. If your SELECT SINGLE contains NOT the key fields of the table in its where conditions, tha you should replace it with SELECT UP TO 1 ROWS... ENDSELECT.

hope this helps

ec

Former Member
0 Kudos

Hi

After adding the new fields Adjust/Activate that table in database utility SE14

and the statement select single * will work as usual.

Are you using it in the loop or outside?

If it is in loop it will consume time..

write outside the loop and read the itab with key.

Regards

Anji

Former Member
0 Kudos

Hi,

Instead of

select single *

specify all the fields in the internal table

select single fld1 fld2 fld3 into table

Thanks,

Nethaji.

Former Member
0 Kudos

Narasimhan,

'select single' should be used only when you have all the primary key field values available. are any of the added new fields part of Primary key fields ? if so use in the following way. This will increase the performance

<b>Select *

..............

up to 1 rows

endselect</b>

Former Member
0 Kudos

Hi

folow these rules

When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index.

To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields . In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.

For testing existence , use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit.

SELECT * FROM SBOOK INTO SBOOK_WA

UP TO 1 ROWS

WHERE CARRID = 'LH'.

ENDSELECT.

The above code is more optimized as compared to the code mentioned below for testing existence of a record.

SELECT * FROM SBOOK INTO SBOOK_WA

WHERE CARRID = 'LH'.

EXIT.

ENDSELECT.

Use Select Single if all primary key fields are supplied in the Where condition .

If all primary key fields are supplied in the Where condition you can even use Select Single. Select Single requires one communication with the database system, whereas Select-Endselect needs two.

<b>Reward if usefull</b>