Skip to Content
author's profile photo
Former Member

Need to improve the performance

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Posted on Sep 28, 2007 at 12:52 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 12:52 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 12:54 PM

    Hi,

    Instead of

    select single *

    specify all the fields in the internal table

    select single fld1 fld2 fld3 into table

    Thanks,

    Nethaji.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 12:54 PM

    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>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 29, 2007 at 06:25 AM

    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>

    Add comment
    10|10000 characters needed characters exceeded